MPD (Music Player Daemon) is one of the best solutions to playing music on GNU+Linux. There's a plethora of different GUI, TUI and CLI clients for it. It's great and all but setting it up on Debian was (at least for me) a pain, so this article should help others trying to do it in the future. As a sidenote, you shouldn't use the version present in Debian Stable because it's very old. The one in the Debian Unstable repos is fine though.

First of all, install mpd, mpc (the CLI client) and/or a client of your preference:

sudo apt install mpd mpc ncmpcpp

Then create a config file for MPD in ~/.config/mpd/mpd.conf that looks like this:

# Put the path to the directory with your music here (tylde is expanded to your homedir)
music_directory "~/Music"

# Output using Pulseaudio
audio_output {
	type "pulse"
	name "Pulseaudio output"

# You can also use ALSA or other backends; see mpd.conf(5)
#audio_output {
#	type "alsa"
#	name "ALSA output"

Next you should disable and stop the systemd service:

sudo systemctl disable mpd
sudo systemctl stop mpd mpd.socket # I'm not sure if you have to put mpd.socket here

And finally, enable and start the systemd service, but not a system-wide one:

systemctl --user enable mpd
systemctl --user start mpd mpd.socket # Again I'm not sure if you have to put mpd.socket here

And you're good to go. MPD will start on user login, and it will work with Pulseaudio (it doesn't work as a non-user service). You can test if your music is seen by MPD by running mpc listall | pager, which lists all scanned files.

If you liked the article, consider donating Monero to my address: 45ZFoDAouGHH1gC697mRLPK9zMAxnnnccSYQj1Aa2BJnjZhWnbeojWRE5RKR9CeY7qYtt2eESYC4mYqypxE7sfxqLdLi3Eh (QR)