How to set up Navidrome for MP3 Streaming on a RaspberryPi

Recently I noticed that I hardly ever listen my MP3 music collection – mainly because I don’t like my music players (both on mobile and on the desktop). So, let’s look for a nicer player!

I had only two constraints: 1) it should be able to use the files from OneDrive and 2) it should be able to cache them (in case of no connectivity). And as I went through the candidates, I stumbled across Navidrome:

Navidrome allows you to enjoy your music collection from anywhere, by making it available through a modern Web UI and through a wide range of third-party compatible mobile apps, for both iOS and Android devices.

Navidrome also supports Playlists and Internet-Radio! Nice. So why not let it run on a RaspberryPi at home and make it available through my VPN? But would I have enough RAM left? I just tried!

TL;DR: RAM / Memory requirements: ~40 MB

Installing

Don’t forget to simply checkout the documentation about Installation at the Navidrome site!

Install Samba and mount Music

Navidrome can only stream from a local file source. So, let’s mount the music from the NAS.

sudo apt-get install samba-common smbclient samba-common-bin smbclient  cifs-utils
sudo mkdir /mnt/music

Mount the NAS directory on startup:

sudo nano /etc/fstab
//diskstation/music /mnt/music cifs user=...,pass=...,iocharset=utf8,rw,uid=1000,gid=1000 0 0

uid and gid should be the same as your pi user’s uid/gid. Well according to the documentation, it would be better to run Navidrome as its own user, just ensure that the user has read permissions on the music folder:

$ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm), .....

Then just mount:

sudo mount -a

If you want to put the credentials into a separate file:

nano ~/.smbcredentials
username=...
password=...
chmod 600 ~/.smbcredentials

And change the entry in /etc/fstab to:

//diskstation/music /mnt/music cifs credentials=/home/pi/.smbcredentials,...

I find it quite handy to reboot the RaspberryPi at this stage to ensure that mounting on startup REALLY works.

Install Docker

curl -sSL https://get.docker.com | sh
sudo usermod -aG docker $USER

Log out and back in after installing docker.

Install Navidrome

I install Navidrome in my home directory. This may not be the best choice, feel free to change it to suit your needs.

mkdir -p ~/navidrome/data
mkdir -p ~/navidrome/backup

Create a ~/navidrome/compose.yaml:

# check the options in the Docs: https://www.navidrome.org/docs/usage/configuration-options/#available-options
services:
  navidrome:
    image: deluan/navidrome:latest
    user: 1000:1000
    ports:
      - "4533:4533"
    restart: unless-stopped
    environment:
      ND_SCANNER_ENABLED: true
      ND_SCANNER_SCHEDULE: "0 19 * * *"
      ND_SCANNER_SCANONSTARTUP: true
      ND_LOGLEVEL: info
      ND_BASEURL: ""
      ND_LASTFM_APIKEY: ...
      ND_LASTFM_SECRET: ...
      ND_SPOTIFY_ID: ...
      ND_SPOTIFY_SECRET: ...
      ND_BACKUP_PATH: /backup
      ND_BACKUP_SCHEDULE: "0 20 * * *"
      ND_BACKUP_COUNT: 7
    volumes:
      - "/home/pi/navidrome/data:/data"
      - "/home/pi/navidrome/backup:/backup"
      - "/mnt/music:/music:ro"

Instead of putting the configuration into the compose.yaml, you could also use a config file. Checkout the documentation for it (I somehow just put it into the compose.yaml without special reason). Also refer to the excellent documentation for how to get the API credentials for LastFM and Spotify.

(Re)Start Navidrome

cd ~/navidrome
docker compose down
docker compose up -d --remove-orphans

And after a successfull start, Navidrome should be available under <hostname>:4533.

Logs

If you need to check the logs (because something is going wrong):

docker compose logs

Client

As mobile client I currently favour Symfonium. It looks pretty nice and the caching mechanism looks good so far. Nothing overly fancy – just simple enough for me. Other apps are listed on the Navidrome page and as Navidrome supports the Airsonic API, you can use any Airsonic compatible player as well.

Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *