Installation_de - Psy-Virus/ampache GitHub Wiki

Installation

Prerequisites

This document assumes that you have installed and configured all prerequisites listed in the README.

Download

Release tarballs are available here. Depending on the feature and how recently it's changed, support might only be available for git HEAD.

Management of your deployment can be much easier if you use a git checkout rather than a tarball: git HEAD.

Emplacement

Whichever method you choose, place the extracted source tree somewhere served by your webserver. The details will depend on your precise setup and desired web path; it's fairly common to put it in a folder called ampache underneath the WWW root.

git checkout example (Gentoo)

cd /var/www/localhost/htdocs
git clone https://github.com/ampache/ampache.git

tarball example (Fedora)

cd /var/tmp
wget https://github.com/ampache/ampache/archive/master.tar.gz
tar -xvzf master.tar.gz
mv master /var/www/html/ampache

Web server configuration

Apache

Ampache is developed to work instantly with Apache without additional configuration except setting up a regular vhost.

Nginx

Working Nginx configuration sample for Ampache

server {
   listen   80;
   server_name FQDN;
   charset utf-8;

   root PATH;
   index index.php;

   # Rewrite rule for Subsonic backend
   if ( !-d $request_filename ) {
      rewrite ^/rest/(.*).view$ /rest/index.php?action=$1 last;
      rewrite ^/rest/fake/(.+)$ /play/$1 last;
   }

   # Rewrite rule for Plex backend
   if ( !-d $request_filename ) {
      rewrite ^/plex/(.*)$ /plex/index.php?action=$1 last;
   }

   # Rewrite rule for Channels
   if (!-d $request_filename){
      rewrite ^/channel/([0-9]+)/(.*)$ /channel/index.php?channel=$1&target=$2 last;
   }

   # Beautiful URL Rewriting
   rewrite ^/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ /play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last;
   rewrite ^/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ /play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last;
   location /play {
      if (!-e $request_filename) {
         rewrite ^/play/art/([^/]+)/([^/]+)/([0-9]+)/thumb([0-9]*)\.([a-z]+)$ /image.php?object_type=$2&object_id=$3&auth=$1;
         break;
      }

      rewrite ^/([^/]+)/([^/]+)(/.*)?$ /play/$3?$1=$2;
      rewrite ^/(/[^/]+|[^/]+/|/?)$ /play/index.php last;
      break;
   }

   location /rest {
      limit_except GET POST {
         deny all;
      }
   }

   location /plex {
      limit_except GET POST {
         deny all;
      }
   }

   location ^~ /bin/ {
      deny all;
      return 403;
   }

   location ^~ /config/ {
      deny all;
      return 403;
   }

   location / {
      limit_except GET POST HEAD{
         deny all;
      }
   }

   location ~ ^/.*.php {
    # PHP config...
   }

   # Rewrite rule for WebSocket
   location /ws {
    rewrite ^/ws/(.*) /$1 break;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8100/;
   }
}

Web-based Installer

Assuming your web stack is set up properly and you chose the standard web path, this link should now take you to the first step of the online installer. If you set things up in a non-standard way, navigate to your chosen install root manually.

Any potential problems with your PHP installation should show up on this initial page.

Installation screenshot

Select a language and press "Start Configuration".

Installation screenshot

Check all errors and warnings about your environment.

Installation screenshot

Fill out the form with the database information.

Installation screenshot Installation screenshot

Fill out the form with the configuration information if needed (blank database password are not accepted). If PHP is able to write to the config/ directory, you will be able to write out the config file directly from this page. If not, or if you just prefer to do it manually, show File Insight and select "Download" and then copy it into the config/ directory manually. You also define on this screen the general Ampache behavior (installation type, transcoding default settings and player backends to enable) ; if you don't know about this at this stage, you can change this settings later in ampache.cfg.php and Ampache preferences.

Installation screenshot

The final step of installation is to create the initial administrative user.