This recipe covers the installation of the Ampache server. It is a simple PHP-based web application. Once installed and set up, you can use a web interface to play your audio/video files or use any of the various popular streaming clients to stream content over the intranet or even the Internet.
We will be using Ubuntu Server 16.04, but you can choose to have any version of Ubuntu.
Additionally, we will need the Samba server. It will be used as shared network storage.
As always, access to a root account or an account with sudo
privileges will be required.
Ampache is a web application developed in PHP. We will start the installation with the LAMP stack. This recipe covers installation with the Apache web server, but you can choose any other web server:
$ sudo apt-get update $ sudo apt-get install apache2 mysql-server-5.5 php7 php7-mysql php7-curl libapache2-mod-php7
For more details on Apache and PHP installation, check Chapter 3, Working with Web Server
$ wget https://github.com/ampache/ampache/archive/3.8.0.tar.gz Extract achieve contents under a web root directory $ tar -xf 3.8.0.tar.gz -C /var/www $ mv /var/www/ampache-3.8.0 /var/www/ampache
$ cd /var/www/ampache $ mv rest/.htaccess.dist rest/.htaccess $ mv play/.htaccess.dist play/.htaccess $ mv channel/.htaccess.dist channel/.htaccess
config
directory. It will need write access to that directory:$ chmod 777 -R config
mod_rewrite
, and set a virtual host pointing to the Ampache directory.mod_rewrite
with the following command:$ sudo a2enmod rewrite
$ cd /etc/apache2/sites-available/ $ sudo vi ampache.conf
ampache.conf
:<VirtualHost *:80> DocumentRoot /var/www/ampache <Directory /var/www/ampache/> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
80
, or alternatively you can use a port other than 80
for Ampache installation.$ sudo service apache2 reload
Here, we have installed and configured the base setup. Now, we can move on to configuration through a web-based installer. You can access the web installer at the domain name or IP address of your server. The installer should greet you with a big Ampache logo and a language selection box; something similar to the following:
config
directory. You can choose to change the installation type and enable transcoding configuration from this screen. Once done, click the Continue button to write the configuration file. If you see any errors, scroll to the bottom of the page and click the write button to write config changes.You have completed the Ampache setup process. Now you need to upload content and enjoy your own streaming server. We will learn to create a catalog and upload content in the next recipe.
Ampache is a web application written in PHP. We have downloaded the latest Ampache code and set it to work with our web server using Virtual Host configuration. Ampache provides sample htaccess
files that set required redirection rules. We have enabled respective rules by renaming the sample files. If you are using a web server other than Apache, make sure you check the Ampache documentation for your web server. It supports Nginx and lighttpd as web servers.
Ampache has made it easy to cross-check all requirements and configure your database connection using the web installer. The installer checks for the required PHP settings and extensions and returns a simple page with things that need to fixed. Next, we can configure database settings and push schema directly from the web installer.
Once everything is configured, the web installer returns the login page, from where you can access the Ampache server.
The Ampache community have created a Docker image for the Ampache server. If you have a Docker system set up, you can quickly get started with Ampache with its Docker image.
You can get the Dockerfile at https://github.com/ampache/ampache-docker.
Ampache is also available in the Ubuntu package repository and can be installed with the following single command:
$ sudo apt-get install ampache mysql-server-5.5
The currently available version of Ampache is 3.6. If you don't care about the latest and greatest updates, you can use the Ubuntu repository for quick and easy installation.