Menu Close

Installing Ampache on Debian 9.


Ampache requires a web server, PHP, and a MySQL database. We will be using Apache, PHP 7, and MariaDB to fulfill these requirements.

Installing the web stack and other required packages.

apt update
apt install -y apache2 mariadb-server mariadb-client php php-common php-mysql php-curl php-xml composer php-gd ffmpeg

And make sure Apache and MariaDB are enabled and running:

systemctl enable --now mariadb.service apache2.service

Database Configuration

Start by running the built-in MariaDB secure installation program:


When prompted for Y/n answers, choose Y for all questions and make sure you set a strong password.

Ampache requires a database and a dedicated MySQL user. Enter the MySQL console:
mysql -u root -p

Create a database named ampache:

MariaDB [(none)]> CREATE DATABASE ampache;

Create a local user named ampache;

MariaDB [(none)]> CREATE USER 'ampache'@'localhost' IDENTIFIED BY 'ampache_password';

Replace ampache_password with a password of your choice.

And grant that user full access to its respective database:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON ampache.* TO 'ampache'@'localhost';

Then exit:

MariaDB [(none)]> exit;

Apache Configuration

Create a new virtual host file with a text editor of your choice, for example:

vim /etc/apache2/sites-available/ampache.conf

And paste the following, replacing SERVER_IP with the correct IP address or your FQDN if you wish to use one.

<VirtualHost *:80>
    ServerName SERVER_IP
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/ampache/
    ErrorLog ${APACHE_LOG_DIR}/ampache-error.log
    CustomLog ${APACHE_LOG_DIR}/ampache-access.log combined
    <Directory /var/www/html/ampache/>
    AllowOverride All

Enable this virtual host:

a2ensite ampache.conf

Enable required Apache modules:

a2enmod rewrite
a2enmod expires

Restart Apache for the changes to take effect:

systemctl restart apache2.service

Ampache Installation:


You can download the latest stable release with the following command:


Extract and move the resulting directory:

tar -xzf master.tar.gz
mv ampache-master/ /var/www/html/ampache/

Ampache uses composer to install and manage dependencies. Optionally, switch to a non-root user before running composer.

cd /var/www/html/ampache
composer install --prefer-source --no-interaction

Once composer finishes, give Apache full ownership of the ampache web root and its content:

chown -R www-data:www-data /var/www/html/ampache

You should be able to access Ampache at http://SERVER_IP/

The remaining configuration will now be done using the web interface. Here are some guidelines:

  1. Select your Preferred Language and press “Start Configuration”
  2. The next page will check if requirements are established.
  3. In the database creation step, fill in the details as follows:
    • Desired Database Name: ampache
    • MySQL Hostname: localhost
    • MySQL port: leave blank
    • MySQL Administrative Username: ampache
    • MySQL Administrative Password: The password chosen during user creation in the MySQL console.
    • Create Database: unchecked
    • Overwrite if database already exists: unchecked
    • Create Tables: checked
    • Create Database User: unchecked
  4. In the configuration generation step:
    • Web Path: /
    • Database Name: ampache
    • MySQL Hostname: localhost
    • MySQL Port: leave blank
    • MySQL Username: ampache
    • MySQL Password: The password chosen during user creation in the MySQL console.
    • Installation type: Assuming you want a fully featured installation for personal use, choose Default.
    • Transcoding Template Configuration: ffmpeg
    • Players: You should leave these settings unchanged in most cases.
  5. Create Admin Account: Choose a username and password and proceed.

Your Ampache installation is now ready for use. You can login at http://SERVER_IP//login.php

You can read about creating your first catalog in the Ampache wiki.



If you plan on uploading files via Ampache, you should change the PHP max upload size. Using a text editor of your choice, open the file /etc/php/7.0/apache2/php.ini and find the following line:

upload_max_filesize = 2M

Change it to:

upload_max_filesize = 100M

This will allow upload of files up to 100MB in size, you can change this value according to your needs.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *