Shell Person Help me keep the shell people alive.


How to Install MPD in Debian Lenny

mpd is my favorite music player. Here's how to install it in Debian Lenny.

You'll need to be root for this (type "su" without the quotes), or add "sudo" before each command.

Install mpd (Music Player Daemon) and mpc (Music Player Command).

apt-get install mpd mpc

Configure mpd. You can use nano (or any text editor) in place of vim if you prefer. I didn't change anything except I commented-out (with the hash symbol) the bind_to_address, as it was causing the following error when I tried to use mpc:

MPD_HOST and/or MPD_PORT environment variables are not set
error: problems getting a response from "localhost" on port 6600 : Connection refused

The bind_to_address line should look like this:

#bind_to_address	""

Put a symbolic link to your music in mpd's default music directory. Obviously you'll need to replace /home/james/music with the path to your music directory.

ln -s /home/james/music /var/lib/mpd/music

Make sure mpd has permission to read your music files. In my case, because all of my music is on an external NTFS drive, all of the file permissions on my music were a little odd. They belonged to the user "james" (me) and the group "users", and did not allow anyone who was not the owner or not in the group to read them. To fix this I added the user "mpd" (which was created when we installed mpd) to the group "users".

usermod -G users mpd

Create the music database. If you're music files don't scroll down the screen, then mpd isn't finding them. Make sure you made the symbolic link to mpd's default music folder, and that the permissions are set correctly.

mpd --create-db

Restart mpd, because earlier we changed mpd.conf.

/etc/init.d/mpd restart

Find and play your music. Replace yourawesomeband with whatever artist you want to listen to.

mpc search artist yourawesomeband | mpc add ; mpc play

Comments (5) Trackbacks (0)
  1. Hi James, i’m in trouble about config an custom mpd server and maybe you could/would help me.
    I have an ubuntu 10.04 server with two different users:

    -user one, the owner of and where music-dir is mounted:

    -user two, an mpd server only user, with manual mpd compiled (mpd-0.15.9.tar.bz2):
    /home/user2/.mpd/ (–>database.db – – /music – mpd.conf – logfile.log – mpdstate)

    the music-dir in mpd.conf(home/user2/.mpd/mpd.conf) point to /home/user2/.mpd/music that is a symbolic link (ln -s) of /home/user1/hd-server/music

    My headache is that doesn’t update database…and the because, i suppouse, could be “wrong permission settings” of the /home/user1/hd-server/music, but all dir have 777 permission:

    the result of command “ls -alt” in /home/user1 is:
    drwxrwxrwx 13 user1:user1 4096 2010-01-16 21:24 hd-server

    the result of command “ls -alt” in /home/user1/hd-server is:
    drwxrwxrwx 7 user1 user1 4096 2010-05-04 22:08 music

    the result of command “ls -alt” in /home/user2/.mpd is:
    lrwxrwxrwx 1 user2 user2 29 2010-05-09 19:31 music -> /home/user1/hd-server/music

    i already did:
    usermod -G user1 user2
    and file /etc/group display:

    but no way to update the database…when i run “mpd –create-db” the “logfile.log” start to grow and it return the list of all my mp3 uploaded…but “database.db” still stay empty. Monitoring update process by GMPC client, it show me all files updating…and i could play it too, but when the updating process end, mpd turn-off/crash.
    If i create a dir /home/user2/.mpd/newmusic with some .mp3, everything works fine.
    I will really appreciate an help!
    Thanks :D

  2. This may not be the answer, but for the sake of being thorough, do you have the correct permissions on user1’s mp3s (not just on the directories, but the files themselves)?

  3. all dir are set to 777:
    drwxrwxrwx 7 user1 user1
    and all .mp3 files too:
    -rwxrwxrwx 7 user1 user1

    (sorry if i’m replay again the same, but i didn’t understood if the other message was saved’n’sent)

  4. Sorry for the slow response, for some reason wordpress didn’t email me when you posted your last comment. Hopefully you’ve got it figured out by now, but in case you don’t, here are a few more suggestions (guesses).

    1. Have you tried using “mpc update” instead of “mpd –update-db”? I’ve had some problems recently with mpd’s –update-db command in Ubuntu.

    2. Have you tried installing the Ubuntu mpd package from the repos? I would want to check, just for the sake of science, if package from the repositories works, in order to rule-out the possibility of a problem with your custom-compiled version.

  5. I had problems to post my past reply in your blog too…was like WP doesn’t recognize my post like news…however, thanks to spend time helping me!

    The headache still going on…i really don’t know what i can do for fix it.
    My goal would be have a music server able to distribute over the net some different playlists at same time, like a webradio multi channel. Thinking in this way i build a server with icecast daemon able to capture all sources and one user for each kind of music/playlists. Icecast is build by user1 with apt-get way…and for each user(music genre) i compiled MPD(tar.bz2) daemon at respective /home dir. All my music is in /home/user1/hd-server/music and ALL user(music genre) can read/write/modify that dir (../hd-server/music).
    IF i run mpd with music dir pointed on ../hd-server/music, it start to “build” the database, but at the end crash without any success…IF i run mpd with music dir pointed on .mp3 files inside respective home/user(music genre) everything works fine. IF i “apt-get install mpd”, it works fine with ../hd-server/music …but in this way i can have just ONLY one mpd daemon (looks like one music genre/playlist) working on server and it’s not my goal…
    At this moment everything is set with 777, but without success.
    It’s really strange…maybe it’s a bug…or maybe i’m the worst dummy in the world :D
    I’m thinking to reset and re-built my server again…but i think it will not be the solution…
    Do you have any suggestions/ideas/workarounds??

Leave a comment

No trackbacks yet.