ampache server

let’s set up an ampache server now we have a NAS mounted as NFS :)

apt-get install ampache takes care of most things but of course we want url rewriting and a proper vhost

following this guide:
https://github.com/ampache/ampache/wiki/Installation

so:

enable mod_rewrite:
sudo a2enmod rewrite

fix error at restart:
* Restarting web server apache2 AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

fix by:
edit /etc/apache2/conf-available/ampache.conf and add the ServerName directive
also globally you can edit /etc/apace2/sites-available/000-default.conf – just add ServerName
if you use vhosts do the same for every vhost

go to [hostname]/ampache and the summary script will list potential problems
one problem: ampache.cfg.php not writable by ampache

yes.. because the file doesn’t exist, yet :D

run the installer:
it warns about SQL database, so let’s install mysql / mariadb
#apt-get install mysql-server
and run #mysql_secure_installation

add sql root password to the configuration and then allow sql to create the database for ampache
(or do it yourself and give the user and database name)

then chown -R www-data:www-data /etc/ampache and /usr/share/ampache/www/config to allow ampache to write the config there. check using the script

ampache.cfg.php exists? [ OK ]
ampache.cfg.php configured? [ OK ]

add the sql user we created in the last step, continue and proceed to adding an admin user and updating the old databases (if needed)

the main page should now load and you can log in as admin

create a new user and set it up as you want :)

don’t forget to add the ports to firewall and port forward if needed (home routers…)

but the version from the ubuntu repositories is buggy.. so let’s install from git!

upgrading ampache note:
https://github.com/ampache/ampache/wiki/Upgrade

If you are upgrading from an older version of Ampache we recommend moving the old directory out of the way, extracting the new copy in its place and then copying the old config/ampache.cfg.php, /rest/.htaccess, and /play/.htaccess files if any. All database updates will be handled by Ampache.

also we need composer

#apt-get install curl php5-cli git
#curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/local/bin –filename=composer

This will download and install Composer as a system-wide command named composer, under /usr/local/bin.

Since 3.8.1, Composer is used to manage dependencies. You should download it and install it (e.g: mv composer.phar /usr/local/bin/composer), then run composer install –prefer-source –no-interaction on Ampache directory.

upgrading steps:

Move your Old Install Directory out of the way

mv ampache ampache.old

Extract the new version (or clone from git)

tar -xzf current.tar.gz
git clone https://github.com/ampache/ampache.git

Copy your config file from the old install to the new directory
(also copy /rest/.htaccess, and /play/.htaccess files if any)

cp ampache.old/config/ampache.cfg.php /etc/ampache/
(there should be a symlink in the config directory, if not: create it)
ln -s /etc/ampache/ampache.cfg.php /usr/share/ampache/config/ampache.cfg.php

check the symlinks in /etc/apache2/conf-enabled and conf-available, too

Attempt to login as normal, Ampache will prompt you for any database upgrades which must be performed

it will complain about composer needing to update stuff
composer install –prefer-source –no-interaction

and it may complain about php-curl and filesize limits
so:
apt-get install php5-curl

and edit php.ini
upload_max_filesize = 80M
post_max_size = 360M
also take care of .htaccess

restart apache and it should update the database and get you started

now for the finishing touch:
sendmail/postfix
iptables
fail2ban
logwatch
automatic updates

and TEST if it works!