Music Player Daemon (MPD)

From DuncanWiki
Jump to: navigation, search

MPD is a daemon that runs on a server giving others (or just yourself) the ability to control what's being played through the soundcard.

What I'm about to detail is all done on CentOS, so you're going to have to perform a little extra work compared to what's required of you in Fedora, but nothing insane. I'm setting this up with a clean install so whatever I detail is all you'll need to do, if you find you're doing extra work that's not detailed here then Contact Me.

Contents

Easier Method

dag.wieers.com supplies an easy to use yum repository for CentOS, I haven't used it nor do I intend to. Please don't ask me for help on how to use it.

Preparation

You'll need to have a CentOS Development Setup previous to setting proceeding with these directions. You can read up on why I'm using Fedora Core 5 RPM files for most of this buildout on my CentOS page.

Download & Compile MPD RPM

The site rpm.livna.org typically maintains a copy of MPD, we're going to download and compile from their SRPM. As of this writing the most recent version is located at ftp://rpm.livna.org/fedora/9/SRPMS/.

Install Yum Supplied Dependencies

First off we'll want to install the CentOS supplied packages that will be required to build MPD.

(duncan@torgo:SRPMS)$ sudo yum install libao-devel flac-devel libtheora-devel speex-devel liboil-devel libcap-devel libtool-ltdl-devel  doxygen libusb-devel  readline-devel libtermcap-devel libsysfs-devel

Compile Remaining Dependencies

Next we're going to need the following RPM files to build MPD.

Here's the order of commands used to grab the source for these packages, compile them and install. I've omitted the output to conserve space.

(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libid3tag-0.15.1b-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libid3tag-0.15.1b-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libid3tag-devel-0.15.1b-2.i386.rpm /usr/src/redhat/RPMS/i386/libid3tag-0.15.1b-2.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libshout-2.2.2-1.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libshout-2.2.2-1.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libshout-2.2.2-1.i386.rpm /usr/src/redhat/RPMS/i386/libshout-devel-2.2.2-1.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libmpcdec-1.2.2-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libmpcdec-1.2.2-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libmpcdec-1.2.2-2.i386.rpm /usr/src/redhat/RPMS/i386/libmpcdec-devel-1.2.2-2.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libsndfile-1.0.15-1.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libsndfile-1.0.15-1.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libsndfile-1.0.15-1.i386.rpm /usr/src/redhat/RPMS/i386/libsndfile-devel-1.0.15-1.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/portaudio-18.1-7.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild portaudio-18.1-7.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/portaudio-18.1-7.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/lirc-0.8.0-3.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild lirc-0.8.0-3.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/lirc-0.8.0-3.i386.rpm /usr/src/redhat/RPMS/i386/lirc-devel-0.8.0-3.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libsamplerate-0.1.2-5.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libsamplerate-0.1.2-5.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libsamplerate-0.1.2-5.i386.rpm /usr/src/redhat/RPMS/i386/libsamplerate-devel-0.1.2-5.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libatomic_ops-1.2-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libatomic_ops-1.2-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libatomic_ops-devel-1.2-2.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/jack-audio-connection-kit-0.101.1-12.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild jack-audio-connection-kit-0.101.1-12.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/jack-audio-connection-kit-0.101.1-12.i386.rpm /usr/src/redhat/RPMS/i386/jack-audio-connection-kit-devel-0.101.1-12.i386.rpm /usr/src/redhat/RPMS/i386/jack-audio-connection-kit-example-cl
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/pulseaudio-0.9.6-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild pulseaudio-0.9.6-2.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/pulseaudio-0.9.6-2.i386.rpm /usr/src/redhat/RPMS/i386/pulseaudio-devel-0.9.6-2.i386.rpm /usr/src/redhat/RPMS/i386/pulseaudio-lib-0.9.6-2.i386.rpm /usr/src/redhat/RPMS/i386/pulseaudio-lib-devel-0.9.6-2.i386.rpm /usr/src/redhat/RPMS/i386/pulseaudio-lib-zeroconf-0.9.6-2.i386.rpm /usr/src/redhat/RPMS/i386/pulseaudio-lib-glib2-0.9.6-2.i386.rpm /usr/src/redhat/RPMS/i386/pulseaudio-module-x11-0.9.6-2.i386.rpm
(duncan@torgo:SRPMS)$ wget ftp://rpm.livna.org/fedora/9/SRPMS/libmad-0.15.1b-6.lvn9.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libmad-0.15.1b-6.lvn9.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libmad-0.15.1b-6.i386.rpm /usr/src/redhat/RPMS/i386/libmad-devel-0.15.1b-6.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/id3lib-3.8.3-15.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild id3lib-3.8.3-15.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/id3lib-3.8.3-15.i386.rpm /usr/src/redhat/RPMS/i386/id3lib-devel-3.8.3-15.i386.rpm
(duncan@torgo:SRPMS)$ wget ftp://rpm.livna.org/fedora/9/SRPMS/faad2-2.6.1-3.lvn9.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild faad2-2.6.1-3.lvn9.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/faad2-2.6.1-3.i386.rpm /usr/src/redhat/RPMS/i386/faad2-libs-2.6.1-3.i386.rpm /usr/src/redhat/RPMS/i386/faad2-devel-2.6.1-3.i386.rpm

Now we're finally ready to build MPD and install, what a chore it was to get this far!

(duncan@torgo:SRPMS)$ wget ftp://rpm.livna.org/fedora/9/SRPMS/mpd-0.13.1-2.lvn9.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild mpd-0.13.1-2.lvn9.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/mpd-0.13.1-2.i386.rpm

Compile From MPD Supplied Source

The .spec file that they ship with MPD is incompatible with CentOS (and I'm guessing Fedora) & would take some tweaking to fix. I may spend time to posting my work to this page in the future.

(duncan@torgo:SOURCES)$ rpmbuild -ta mpd-0.13.2.tar.bz2 
error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: Group field must be present in package: (main package)
error: License field must be present in package: (main package)

Configuration

MPD Configuration File

This is what i'm using for my /etc/mpd.conf :

port                    "6600"
music_directory         "/mpd/music"
playlist_directory      "/mpd/playlists"
log_file                "/mpd/mpd.log"
error_file              "/mpd/mpd.error"
db_file                 "/mpd/mpd.db"
state_file              "/mpd/mpdstate"
mixer_type              "alsa"
mixer_device            "default"
mixer_control           "PCM"
ao_driver               "alsa09"
ao_driver_options       "dev=hw:0,0"

Start On Boot

sudo /sbin/chkconfig --level 35 mpd on

Open Firewall Port

Now we want to open up the port 6600 & make sure that it's available during the next reboot.

sudo /sbin/iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6600 -j ACCEPT
sudo /sbin/service iptables save
sudo /sbin/service iptables restart

Clients

There are several MPD clients available, some run locally on the remote computer or as a website. A healthy list of them is located at http://www.musicpd.org/clients.shtml, I'll focus on using a single web client and one for Gnome.

Web Client

http://pitchfork.remiss.org:84/

Gnome Client

I like gmpc for its simplicity & intuitive interface. It's full featured & relatively painless to configure.

Before I start compiling gmpc I'm going to need to install a bunch of dependencies, some will be installed via yum and the rest will be downloaded and compiled themselves. To save time I'll list out the files that we're going to need with the yum command I used to install them.

(duncan@torgo:SRPMS)$ sudo yum install gtk2-devel gnome-vfs2-devel libglade2-devel perl-XML-Parser libmpd-devel curl-devel xosd-devel gtk+-devel gdk-pixbuf-devel esound-devel arts-devel alsa-lib-devel libogg-devel libvorbis-devel mikmod-devel gettext-devel libXt-devel libSM-devel libXxf86vm-devel

Next I'll have to compile the remaining dependencies and download the gmpc source, I downloaded the following RPM files :

Here is what I ran, I'm omitting the output to keep this page as simplistic as possible.

(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/libmpd-0.12.0-3.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild libmpd-0.12.0-3.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/libmpd-0.12.0-3.i386.rpm /usr/src/redhat/RPMS/i386/libmpd-devel-0.12.0-3.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/xmms-1.2.10-25.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild xmms-1.2.10-25.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/xmms-devel-1.2.10-25.i386.rpm /usr/src/redhat/RPMS/i386/xmms-libs-1.2.10-25.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/bmp-0.9.7.1-4.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild bmp-0.9.7.1-4.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/bmp-devel-0.9.7.1-4.i386.rpm /usr/src/redhat/RPMS/i386/bmp-0.9.7.1-4.i386.rpm
(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/xosd-2.2.14-6.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild xosd-2.2.14-6.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/xosd-2.2.14-6.i386.rpm /usr/src/redhat/RPMS/i386/xosd-devel-2.2.14-6.i386.rpm

Now that you've completed the gauntlet of dependencies, you're ready to compile and install gmpc.

(duncan@torgo:SRPMS)$ wget http://download.fedora.redhat.com/pub/fedora/linux/extras/5/SRPMS/gmpc-0.13.0-1.fc5.src.rpm
(duncan@torgo:SRPMS)$ rpmbuild --rebuild gmpc-0.13.0-1.fc5.src.rpm
(duncan@torgo:SRPMS)$ sudo rpm -Uvh /usr/src/redhat/RPMS/i386/gmpc-0.13.0-1.i386.rpm

You'll now see gmpc under Applications -> Sound & Video -> Gnome Music Player Client

A More Modern Client

As of this writing, gmpc 0.15 is available for Fedora 9. You can follow the above instructions and substitute the following libmpd & gmpc source rpms in the instructions.

Personal tools