Install Ampache audio streaming server on Debian 4.0 Etch Ampache is a software that allow you to stream your audio files on Internet. Before choosing this tool, i've tried Jinzora and KPlaylist, but Jinzora is way too complex and KPlaylist way to simple :D. Ampache is a great tool, simple of use, and with many functionnalities that fit me well. This article help you to install Ampache on Debian 4.0 Etch Dependencies First, you need a HTTP server with PHP support. You can for exemple use Lighttpd as described in my article Install Lighttpd and PHP 5 on Debian 4.0 Etch. We add the Debian Multimedia repository in order to make Lake available: /bin/echo "# Debian Multimedia Etch repository deb http://www.debian-multimedia.org etch main" \ | /usr/bin/tee /etc/apt/sources.list.d/etch-debian-multimedia.list
We download the GPG key signing these repositories: /usr/bin/gpg --keyserver pgp.mit.edu --recv-key 07DC563D1F41B907 /usr/bin/gpg -a --export 07DC563D1F41B907 | /usr/bin/apt-key add - We update the list of available packages: /usr/bin/apt-get update
We install the needed PHP modules, and additionnal software for file transcoding: /usr/bin/apt-get install php5-mysql php5-xmlrpc mysql-client-5.0 flac \ mp3splt lame faad ffmpeg vorbis-tools Install We download the last Ampache version. In order to do this, choose the version you want to install: VERSION=3.4 Download the Ampache sources: /usr/bin/wget http://ampache.org/downloads/ampache-$VERSION.tar.gz \ --output-document=/tmp/ampache-$VERSION.tar.gz Once the download complete, extract the file into the temporary folder: /bin/tar --directory=/tmp -xzf /tmp/ampache-$VERSION.tar.gz And move the created folder: : /bin/mv /tmp/ampache-$VERSION /opt/ampache
Create a symbolic link to make Ampache available to the HTTP server: /bin/ln -s /opt/ampache /var/www/ampache
We move configuration files to a place that fit them better: /bin/mv /opt/ampache/config /etc/ampache /bin/ln -s /etc/ampache /opt/ampache/config
Once this done, we create the Ampache database. In order to do this, I encourage you to follow my howto MySQL for Debian 4.0 Etch. Warning : If you have followed my howto, you can skip this lines. Otherwise, replace the bold text with the ones corresponding to your MySQL database: MYSQL_DB=AMPACHE MYSQL_USERNAME=ampache MYSQL_USERPWD=ampache_password
Once the database created, you need to create the tables. This is done by: /usr/bin/mysql --user=$MYSQL_USERNAME --password=$MYSQL_USERPWD $MYSQL_DB \ < /opt/ampache/sql/ampache.sql You now need to update Ampache configuration. These command lines do the trick: /bin/cp /etc/ampache/ampache.cfg.php.dist /etc/ampache/ampache.cfg.php /bin/sed -i \ -e "s/;\(web_path[^=]*=\).*/\1 \"\/ampache\"/" \ -e "s/\(database_name =\).*/\1 \"$MYSQL_DB\"/" \ -e "s/\(database_username =\).*/\1 \"$MYSQL_USERNAME\"/" \ -e "s/\(database_password =\).*/\1 \"$MYSQL_USERPWD\"/" \ /etc/ampache/ampache.cfg.php
Once this done, you only need to create a admin account. This can be done by using this URL: You can now delete the PHP file used to install Ampache: /bin/rm /opt/ampache/install.php Your Ampache install should be working now. You only need to place your audio files on your server, and configure the corresponding catalogs. Files transcoding In order to stream all kind of audio files, we configure Ampache to transcode into MP3 other audio file formats. First, we disable existing settings: /bin/sed -i -e 's/^transcode_/;transcode_/g' /etc/ampache/ampache.cfg.php And we insert the lines corresponding to our transcoding configuration: echo '
;###################################################### ; These are commands used to transcode non-streaming ; formats to the target file type for streaming.
transcode_m4a = true transcode_m4a_target = mp3 transcode_flac = true transcode_flac_target = mp3 transcode_mp3 = false transcode_mp3_target = mp3 transcode_mpc = true transcode_mpc_target = mp3 transcode_MPC = true transcode_MPC_target = mp3 transcode_ogg = true transcode_ogg_target = mp3 transcode_wma = true transcode_wma_target = mp3
; These are the commands that will be run to transcode the file transcode_cmd_flac = "flac -dc %FILE% | lame -q 2 -b %SAMPLE% -S - - " transcode_cmd_m4a = "faad -f 2 -w %FILE% | lame -r -b %SAMPLE% -S - -" transcode_cmd_mp3 = "mp3splt -qnf %FILE% %OFFSET% %EOF% -o - | lame --mp3input -q 2 -b %SAMPLE% -S - -" transcode_cmd_ogg = "oggdec -Q %FILE% -o - | lame -q 2 -b %SAMPLE% -S - -" transcode_cmd_wma = "ffmpeg -i %FILE% -f wav - | lame -q 2 -b %SAMPLE% -S - -" transcode_cmd_mpc = "ffmpeg -i %FILE% -f wav - | lame -q 2 -b %SAMPLE% -S - -" transcode_cmd_MPC = "ffmpeg -i %FILE% -f wav - | lame -q 2 -b %SAMPLE% -S - -" ' | /usr/bin/tee -a /etc/ampache/ampache.cfg.php
Going deeper
Music Player Daemon It is possible to use Ampache to control a "MPD". It allow you to use your Ampache server to play sound locally (aka. on its sound card). It is very usefull if you want to use one of your computers as a network controled Jukebox. I will not describe howto to setup such a thing, since i don't need it, but I am willing to point you this feature. Ampache bind mod_proxy If you use Apache to gather all of your different sites on a same port, or for anyother reason, it is necessary to lightly edit Ampache. - Edit the file /opt/ampache/lib/init.php.
- Replace this line
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; By the following line: $results['web_path'] = 'http://music.landure.fr'; // $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; Where the bold text is your Ampache URL. courtesy http://howto.landure.fr/gnu-linux/debian-4-0-etch-en/install-ampache-audio-streaming-server-on-debian-4-0-etch
|