Sunday, June 1, 2008

How to install mpd (Music Player Daemon) in Ubuntu


I have searching on the web for a good howto for installing mpd with mpc and ncmpc in Ubuntu Linux, but all the howtos were somehow complicated or they didn't work well for me. So I deicide to write some simple howto about the subject.

First of all, what is mpd?
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 also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often. (www.musicpd.org) Plus it's very light on your computer resources and the sound output is of a very great quality.

OK. Let's get started.
First, fire up the Terminal (Applications -> Accessories -> Terminal) and put this code in it:

sudo apt-get install mpd mpc ncmpc

This will install mpd, mpc (console client for mpd) and ncmpc (Ncurses console frontend for mpd). Then, we must 'show' to mpd where is our music collection on our Ubuntu machine. Again in Terminal:

sudo ln -s /path/to/music /var/lib/mpd/music

Replace the /path/to/music with real path to your music folder on your computer. Then:

sudo mpd --create-db

to add the songs to the mpd database, and:

mpc update

to update mpc.

Just in case, restart mpd with:

sudo /etc/init.d/mpd restart

Repeat last four steps for each music folder on your computer.
Finnaly, you can start ncmpc with:

ncmpc

in Terminal.

Some tips:
sudo mpd --kill will shutdown mpd and sudo mpd will start it again.
If you leave mpd playing while you restart or shutdown your computer, mpd will continue playing when you're next time on the login screen.

You can use Sonata, or gcmpc instead of ncmpc, but they are GUI(GTK) frontends for mpd. ncmpc is my choice ;)
Enjoy!

No comments: