Home > Geek Stuff, Linux > Console Junkie: Installing MPD and grooving away to glory!

Console Junkie: Installing MPD and grooving away to glory!

What is MPD?

Quoting from this article:

Music Player Daemon (MPD) allows remote access for playing music (MP3, Ogg Vorbis, FLAC, AAC, Mod, and wave files) and managing playlists. MPD is designed for integrating a computer into a stereo system that provides control for music playback over a local network. It is also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.

In this post, I’ll be explaining how to get MPD up and running on Ubuntu (9.04). If you are working on some other platform, you can simply compile from source wherever applicable. Also, this post is mainly about using mpd as a desktop music player. The configuration part of it is common across distributions. So lets get started!

First, we need to install mpd.

sudo apt-get install mpd

Let us now configure it and get it up and running. You can either directly configure mpd for system-wide usage (/etc/mpd.conf) or you can configure it on a per user basis (~/.mpdconf).

sudo cp /etc/mpd.conf ~/.mpdconf

Before we edit our .mpdconf file, we need to create a few directories.

mkdir -p ~/.mpd/playlists

Now, re-define the following parameters to your .mpdconf file. (These will already be present in your file, just change the value in the quotes to shown values. I’ll explain the meaning of the options further on.)

music_directory "~/Music"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/tag_cache"
log_file "~/.mpd/mpd.log"
error_file "~/.mpd/errors.log"
pid_file "~/.mpd/pid"
port "6600"

Now, music_directory is your music directory; and you probably don’t have all of your music in one directory. What we need to do is add symlinks to all the places where you do have your music files.

cd ~/Music
ln -s "path_to_music_1"
ln -s "path_to_music_2"

pid_file stores the pid of the running daemon. This is useful if you want to kill mpd, you only have to say mpd --kill. The db_file maintains your music database. The rest, I believe, is self-explanatory.

Okay, so we’re all set up now. Start mpd by typing mpd in the terminal.

mpd

mpd is now running. We will now build a database of our music for mpd to work with.

mpd --create-db

This will go through your music_directory and create your db_file.

Now all we need is a client to connect to the daemon. One of the more popular clients for mpd is gmpc, which is fancy to look at and comes with fancy plugins like last-fm scrobbler, lyricwiki, album covers from amazon etc. A good gmpc installation guide can be found here. However, I’m more of a console person, and I prefer to use ncmpc. This can be installed as follows:

sudo apt-get install ncmpc

I keep both gmpc as well as ncmpc on my machine, because sometimes I like to use gmpc for album covers, lyrics and jamendo/last.fm. Mostly though, I use ncmpc. ncmpc is unbelievably powerful. It is also so simple to use that I believe you will be able to figure it out all on your own. Just type ncmpc in the terminal!

Happy grooving!

  1. Jitesh
    June 22, 2009 at 4:25 pm | #1

    Also tell me how to run X within the console :P :P

  1. No trackbacks yet.