Music Player Daemon (MPD) is a powerful and flexible server-side application for playing music. In a home environment, you can connect an MPD server to a Hi-Fi system, and control the server using a notebook or smartphone. You can, of course, play audio files on remote clients. MPD can be started system-wide or on a per-user basis.
The main advantage of MPD is that it’s extremely lightweight and will happily play music on the most humble of hardware. It can handle huge music libraries, lets you control your music from any device, and offers gapless playback.
We’re going to walk you through a very simple setup of MPD. It provides the basics. As you learn more about MPD, you can add additional configuration.
Install MPD
We’re going to show you how to start MPD on a per-user basis.
On Ubuntu, there’s a package in the software repositories. Install the package mpd with apt:
$ sudo apt install mpd
Configure MPD
The above command installs mpd as a system service. But we don’t want this. Let’s stop mpd and disable it running as a system service.
$ /etc/init.d/mpd stop
$ sudo update-rc.d mpd disable
Issue the following command:
$ mkdir -p ~/.mpd/playlists
Now extract and copy the default config file:
$ gunzip -c /usr/share/doc/mpdconf.example.gz > ~/.mpdconf
Use a text editor (such as nano) to edit the .mpdconf file and make it a very basic config file. The lines below are the bare minimum, but they are sufficient to get up and running. Our music is stored in ~/Music, change that directory if your music is stored in a different location.
These are the lines in our example ~/.mpdconf
music_directory "~/Music"
db_file "~/.mpd/database"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/database"
log_file "~/.mpd/log"
pid_file "~/.mpd/pid"
state_file "~/.mpd/state"
input {
plugin "curl"
}
audio_output {
type "pipewire"
name "PipeWire Sound Server"
enabled "yes"
}
Now we can run mpd with the command:
$ mpd
We want mpd to automatically start when starting the machine. Let’s create an autostart file at ~/.config/autostart/mpd.desktop
[Desktop Entry] Encoding=UTF-8 Version=0.23.12 Type=Application Name=Music Player Daemon Comment= Exec=mpd StartupNotify=false Terminal=false Hidden=false
Now we’re ready to use an MPD client to listen to music. Check out our Audio section for the finest free and open source MPD clients.