Skip to content

Ampache


Install ampache from source on Ubuntu

We install ampache with root access so become root before you getting started by su and enter the password for become root

su
apt install -y nginx mariadb-server php php-fpm php-mysql php-cli php-curl php-xml php-mbstring php-zip php-gd php-intl
mkdir -m755 -p /var/www/ampache
cd /var/www/ampache
wget https://github.com/ampache/ampache/releases/download/7.4.0/ampache-7.4.0_all_php8.3.zip
unzip ampache-7.4.0_all_php8.3.zip
chown -R www-data:www-data /var/www/ampache

Create database for ampache

It's not necessary to do this manually since we can do it from the browser but if this is really wanted here is how we can setup the database for ampache

mysql -u root -p
CREATE DATABASE ampache;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON ampache.* TO 'wuseman'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Configure nginx for ampache

cat << "EOF" > /etc/nginx/sites-available/ampache
server {
    listen 80;
    server_name localhost;

    root /var/www/ampache/public;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires max;
        log_not_found off;
    }

    access_log /var/log/nginx/ampache.access.log;
    error_log /var/log/nginx/ampache.error.log;
}
EOF

ln -s /etc/nginx/sites-available/ampache /etc/nginx/sites-enabled/
nginx -t && sudo systemctl reload nginx

Change upload size to 100MB since 2MB wich is default is to small

sed -i 's/^\s*upload_max_filesize\s*=.*/upload_max_filesize = 100M/' /etc/php/8.3/fpm/php.ini

Set correct permissions for ampache directory

chmod -R 755 /var/www/ampache
  • Visit http://localhost and continue the installation and configuration of ampache. If everything was correct installed you should see the below window in your browser

Screenshot