File ampache-README.SUSE of Package ampache

How to set up Ampache for the first time
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(see further below for hints on how to update an existing installation)


Note: Since Ampache 3.8.1, you must first install Composer dependencies with:

    cd @APACHE_SERVERROOT@/ampache
    composer install --prefer-source --no-interaction


Step 1. Configure mysql. First, start it:

	rcmysql start (upon the very first start, it is initialized)

set root passwort:

	/usr/bin/mysqladmin -u root password 'secret'

create database named "ampache" and grant a user authenticating as wwwrun all permissions on it:

	mysql -u root -p
	mysql> create database ampache;
	Query OK, 1 row affected (0.02 sec)

	mysql> GRANT ALL PRIVILEGES ON ampache.* to ampache@localhost IDENTIFIED BY 'othersecret';
	Query OK, 0 rows affected (0.02 sec)

	mysql> quit
	       Bye

Note. Because we suggested in earlier versions to create a database named
      "ampache", we are now suggesting a different name so updates can work
      (the tables have changed and need to be recreated).

initialize ampache database:

	mysql -D ampache -u ampache -p < /usr/share/doc/packages/ampache/ampache.sql



Step 2. Configure ampache:

edit /etc/ampache/ampache.cfg to contain the right password and username for accessing the mysql
database, and set the "web_path".

You may review the apache2 configuration in /etc/apache2/conf.d/ampache.conf
but no changes should be needed for now.

Now create admin user.
You can do this over /etc/amapache/ampache.cfg or over console.

a) over config-file

change 
      use_auth = "true" to "false" 
      default_auth_level = "guest" to "admin"

open the URL
	http://hostname/ampache

in a browser and set the password of the ampache user:

-> Preferences -> Account

make sure to set the admin password to a more secure one ;-)
You do that by simply creating an account for yourself (Admin -> Users -> ...),
giving it "admin" rights, and delete the initial admin user.

You can add additional users now or later - but it's important to change the 
default "open" setting to a more secure one now. Edit /etc/ampache/ampache.cfg and set

    use_auth    = "yes"
    default_auth_level = "guest"

Afterwards only valid users can access ampache.

b) over console

php @APACHE_SERVERROOT@/ampache/bin/install/add_user.inc -u _loginname_ -l admin -p _password_ -e _mailadress_ -n _Name_
You must change _loginname_, _password_, _mailadress_ and _Name_ with your values.



Step 3. Configure your web browser to start an mp3 player for the 
respective mime type (you have probably already done that). 

With a text browser, you might want to put this in ~/.mailcap:

	audio/mpegurl;/usr/bin/xmms %s


Step 4. Just a hint for further experimentation... if you run the ampache server
behind another machine, you can reverse proxy it and map its URL space into,
for example, a virtual host:

<VirtualHost *>
    RewriteEngine on
    ServerName your.external.server

    <IfModule mod_proxy.c>
	ProxyVia on
	ProxyPass /admin        http://ampache.internal/ampache/admin/
	ProxyPass /             http://ampache.internal/ampache/
	RewriteRule ^/(.*)      http://ampache.internal/ampache/$1 [P,L]
    </IfModule>
</VirtualHost>

This implies that you setup the ampache server (in step 2.) to the DNS name
that is reachable from the outside.



Note on update to 3.3.1.2
^^^^^^^^^^^^^^^^^^^^^^^^^

The path to the main index file has changed. You need to replace
	Alias /ampache          @APACHE_SERVERROOT@/ampache/docs
by
	Alias /ampache          @APACHE_SERVERROOT@/ampache
in your apache configuration.




How to update an existing (pre-v3.2) installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

!! All database updates to Ampache starting with 3.2 are handled by ampache
!! himself, when you first use it after installing the newer package.
!! (If you update in the running system, it might help though to log out before,
!! to avoid confusion.)
!! This means, you don't need to follow the steps detailed below. 
!! Note however that you might put the correct name of the database into
!! /etc/ampache.cfg (local_db parameter). Your database might be named ampache3_1.

!! I'm actually not sure whether updates from older versions to 3.2.2 work
!! without the below manual migration. I'm leaving the instructions here in
!! case you need them.

If you update from v3.0 to v3.1, as in an update to SUSE Linux 9.1, you need to
read /usr/share/doc/packages/ampache/MIGRATION and follow the directions!

Before using the migration scripts, install a few needed perl modules:
yast -i perl-DBI perl-Msql-Mysql-modules perl-Data-ShowTable

Make a list of your existing catalogues, you'll need to recreate them.

The configuration file has changed.
Merge your settings from /etc/ampache.conf.inc.rpmsave into /etc/ampache.cfg.
Note: leave 'local_db = ampache3_1' unchanged (see below).
Note: Also adjust the 'web_path' setting to your base URL.

The database format has changed, too.
Create new database:

	 # mysql -u root -p
	Enter password:
	Welcome to the MySQL monitor.  Commands end with ; or \g.
	Your MySQL connection id is 6 to server version: 3.23.55-log

	Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

	mysql> create database ampache3_1;
	Query OK, 1 row affected (0.04 sec)

	mysql> GRANT ALL PRIVILEGES ON ampache3_1.* to wwwrun@localhost IDENTIFIED BY 'othersecret';
	Query OK, 0 rows affected (0.05 sec)

	mysql> quit
	Bye

Initialize the new database structure:
	mysql -D ampache3_1 -u wwwrun -p < /usr/share/doc/packages/ampache/ampache.sql

Edit and run the migration scripts:
	cd @APACHE_SERVERROOT@/ampache/bin/

	vi export_playlist.pl
	./export_playlist.pl ~/ampache-playlists

	vi migrate_user.pl
	./migrate_user.pl





Reload apache/apache2.

Log in and recreate your catalogues.

Re-import your playlists:

	vi ./import_playlist.pl
	./import_playlist.pl ~/ampache-playlists



	
Ugrade starting from version 3.8.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Every attempt is made to make upgrading your Ampache installation as painless as possible. 
Although we do everything we can to prevent data loss during an upgrade it is never a bad idea to backup your database before performing an upgrade. 
Below is a simple command line way to backup your MySQL database. Whenever you upgrade Ampache it is recommend that you run a catalog Verify 
so that any improvements/changes to the tag reading process are applied to your local collection. 
The catalog verify is not forced during the upgrade due to the length of time it can take.

mysqldump -u <USERNAME> -p <AMPACHEDB> --add-drop-table --allow-keywords > mybackup.sql
Basic Instructions

    Move your Old Install Directory out of the way

mv ampache ampache.old

    Extract the new version

tar -xzf current.tar.gz

    Copy your config file from the old install to the new directory

cp ampache.old/config/ampache.cfg.php ampache/config/

    Since Ampache 3.8.1, don't forget to update Composer dependencies with composer install --prefer-source --no-interaction

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

Maintenance mode

If you attempt to run migration or custom scripts, it's good practice to put your website in maintenance mode to avoid users doing mistakes during that time.

To put Ampache in maintenance mode, simply create a new .maintenance file in Ampache root directory. An example redirecting a page hosted in ampache.org is provided under .maintenance.example file. When creating your custom message, don't forget to add exit; at the end to stop the sc

ript going further.
openSUSE Build Service is sponsored by