Home Server Music Player Daemon


09-Dec-2011: initial release.
02-Aug-2012: Added avahi (zeroconf) setup.
17-Jan-2013: adjusted for Slackware.
08-Dec-2013: updated to the latest package builds.



If you have stored your music collection on the Home Server and maybe have installed a DLNA server, then you could also use your server to play music. It’s almost certain that your server has a sound card on the motherboard so all you need to do is add some speakers. Or, just connect some USB speakers.

The Music Player Daemon, or in short MPD, is ideally for this purpose. It runs on the server and can be controlled from a workstation, a web interface, from your phone or tablet.



Make sure your server has alsa-utils installed and that you can play mp3 files with a command line player like mpg123. With alsamixer you can set the mixer levels from the console. When this works you can build the libmpdclient and mpd packages from this site and install it.This package runs mpd as user mpd in group mpd. This user is a member of the audio group. Edit /var/mpd/.mpdconf , for example like this:

music_directory    "~/music"
playlist_directory "~/.mpd/playlists"
db_file            "~/.mpd/database"
log_file           "~/.mpd/log"
pid_file           "~/.mpd/pid"
state_file         "~/.mpd/mpdstate"
sticker_file       "~/.mpd/sticker.sql"
user               "mpd"
group              "mpd"
bind_to_address    "any"

input {
        plugin     "curl"

audio_output {
        type       "oss"
        name       "Server Speakers"
        device     "/dev/dsp"
        format     "44100:16:2"
        mixer_type "software"


It is possible to add more output devices like the httpd or shout server outputs. From the client (not all support that) you can toggle each output on or off. Default they are all on. I have used the oss output here, in some cases the alsa output doesn’t work. See for yourself what works. If you need oss, then make sure to load the modules snd_pcm_oss and snd_mixer_oss. You can add these to the bottom of /etc/rc.d/rc.modules.

Link the music directory to the location where your music is, for example:

root@homsrv:/var/mpd# rmdir music
root@homsrv:/var/mpd# ln -s /mnt/media/Audio music


Now start the daemon:

root@homsrv:~# /etc/rc.d/init.d/mpd start
Starting mpd: /usr/bin/mpd /etc/mpd.conf
Failed to load database: Failed to open database file "/var/mpd/database": No
such file or directory


The first time it will build the database, so that is the reason you see an error message. It can take a long time before it is finished, you can see that if you tail the logfile. If all works well, and if you used the build from this site, you can run pkgbuild, setup and add mpd to start at system boot. In other cases, adding the startup command to rc.local will work fine too.


On the server you can install the mpc package. This is a very simple command line client. For all other clients I don’t give any advice, there are too many choices. Just use the Internet to find clients.


See the download page for the script and configuration files.