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


Step 1. Configure mysql. First, start it, as root:

	systemctl start mysqld.service (upon the very first start, it is initialized)

        or for Fedora <= 14 or Rhel <= 6

	/etc/rc.d/init.d/mysqld start

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 wwwrun@localhost IDENTIFIED BY 'othersecret';
	Query OK, 0 rows affected (0.02 sec)

	mysql> quit
	       Bye

initialize ampache database:

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



Step 2. Configure ampache:

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

You may review the apache configuration in /etc/httpd/conf.d/ampache.conf,
but no changes should be needed for now (unless you have httpd < 2.4).


open the URL
	http://hostname/ampache

in a browser and login with the following:

  - Username: admin
  - Password: changeme

or, if that does not work, set use_auth = "no" in /etc/ampache.cfg

make sure to change 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.


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          /var/www/ampache/docs
by
	Alias /ampache          /var/www/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 /var/www/ampache/bin/

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

	vi migrate_user.pl
	./migrate_user.pl





Reload apache.

Log in and recreate your catalogues.

Re-import your playlists:

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


If your apache server is not running on standard port 80,
just log in as admin, and access the tab config->system, 
and set http non-default port to the number you want.

