How to install and configure an MPD Icecast server on Fedora Core 6

Apr 17, 2007 10:00 GMT  ·  By

Music Player Daemon (MPD) is a music player which allows remote access for playing music and managing playlists. Together with Icecast, it integrates perfectly within a 'headless'-type computer (without a monitor), allowing control and providing playback over a network or over the Internet. Basically, it allows you to listen to your favorite music from anywhere, as long as you have a client that controls MPD (changes the song, volume etc) and a player that supports the Ogg format, like Amarok, XMMS, Winamp and so on. MPD also makes a great music player, especially if you're a console junkie or you restart the X server often.

INSTALLING MPD

Open a terminal and type the following (skip the first command if already logged-in as root):

code
$ su -
Enter root passwd:
# yum install mpd
CONFIGURING MPD

Open the /etc/mpd.conf file using your favorite text editor and change the required paths. Use your regular user's home directory:

code
music_directory "/home/USER/music"
playlist_directory "/home/USER/music/playlists"
db_file "/home/USER/.mpd/mpd.db"
log_file "/home/USER/.mpd/mpd.log"
error_file "/home/USER/.mpd/mpd.error"
In the same configuration file, set the user MPD on which it will run, the address and port to listen to (only if you have multiple interfaces and will like MPD to only be available on one interface), and the shout output:
code
user "USER"

bind_to_address "127.0.0.1"
port "6600"

audio_output {
type "shout"
name "Stream short description"
host "localhost"
port "8000"
mount "/mpd.ogg"
password "hackme"
quality "5.0"
# bitrate "128"
format "44100:16:2"
# user "source" # optional
# description "My Stream Description" # optional
# genre "jazz" # optional
# public "no" # optional
}
Of course, you'll have to replace USER with the name of your regular user. Next, create the directories by running these commands as user:
code
$ cd $HOME
$ mkdir -p music/playlists
$ mkdir .mpd
You can also switch between the quality and bitrate options but don't activate both at the same time. If quality is activated, the output will have a variable bitrate, whereas the bitrate option allows you to choose a static one.

INSTALLING AND CONFIGURING ICECAST

Open a root terminal and type:

code
# yum install icecast
After installation, open the icecast configuration file, /etc/icecast.xml and replace localhost with the hostname MPD is running on:
code
localhost
If you're going to run a public Icecast server, you should also replace all the occurrences of 'hackme' with decent passwords and change the password in the mpd.conf under audio_output as well.

INSTALLING A WEB-BASED MPD CLIENT

Pitchfork is a modern webinterface to MPD as it supports many features such as volume adjusting, managing playlist, modify server settings, album art, lyrics fetching and so on. You can also listen to your Icecast server through Pitchfork.

Before installing Pitchfork, make sure you have a webserver installed, as well as PHP and PHP-Pear by opening a root terminal and typing:

code
# yum install install httpd mysql-server php php-mysql php-gd php-pear
Next, download the latest version of Pitchfork from HERE and save it anywhere on your disk. Then open a root terminal and extract it to the web directory (change the version number if it's newer in your case):
code
# cd /var/www/
# tar xfj /where/you/downloaded/pitchfork-0.5.1.tar.bz2
# mv pitchfork-0.5.1 pitchfork
Now copy the pitchfork configuration file from the doc directory to the apache's conf.d directory:
code
# cp /var/www/pitchfork/doc/pitchfork.conf /etc/httpd/conf.d/pitchfork.conf
Make sure the paths from Alias and Directory are set correctly to /var/www/pitchfork.

Open Firefox (or other DOM2 capable browser: konqueror, opera but NOT iexplore) and go to http://hostname.or.ip.address.of.the.server/pitchfork. Here, set the configuration options based on the mpd.conf file and click Save.

RUNNING MPD AND ICECAST

Before starting, remember to put some mp3 or ogg files in the /home/USER/music directory.

Finally, from a root terminal, type:

code
# service httpd start
# service icecast start
# service mpd start
In the browser pointed at pitchfork, add some files to the playlist and click play. Also, add the http://server.hostname:8000/mpd.ogg URL to your music player (XMMS, Amarok etc).

Enjoy!