In this tutorial we'll go through the process of setting up mpd as a user service. This is just a bare minimum installation setup. If you want customizations then you can look up dotfiles on the internet - lots of people share it. Here's mine.

First thing first - download the mpd package along with the mpd clients mpc and ncmpcpp.

# On Arch
sudo pacman -S mpd ncmpcpp mpc

# On Ubuntu
sudo apt install mpd ncmpcpp mpc

You can choose other mpd clients instead of ncmpcpp of course.

Setup the config files

It's a good practice to keep all the mpd configs in the ~/.config/mpd directory. If you don't have one create it.

Just to get started, you can copy the example config file that mpd provides.

cp /usr/share/doc/mpd/mpdconf.example ~/.config/mpd/mpd.conf

In order to be able to run mpd, you'll need to set up at least these parameters in the mpd.conf file

music_directory       "~/Music"
playlist_directory    "~/.config/mpd/playlists"
db_file               "~/.config/mpd/database"
log_file              "~/.config/mpd/database"
pid_file              "~/.config/mpd/pid"
state_file            "~/.config/mpd/state"

It's not necessary to create any of these files as mpd will itself create them.

Start the service as a user

systemctl --user enable mpd
systemctl --user start mpd

Don't forget the --user flag !

Update the music database

mpc update

For some reason this command alone does not work me. So I run an additional command

mpc ls | mpc add

That's it ! You should now be able to run ncmpcpp and see all your songs.