#!/linuxSucks/Navidrome

Nov 25, 2022

Is a self host music streaming service, if you are like me and you own your own music Navidrome is your best choice.

Navidrome can be used as a standalone server, that allows you to browse and listen to your music collection using a web browser.

It can also work as a lightweight Subsonic-API compatible server, that can be used with any Subsonic compatible client.

Install Navidrome

Two ways to install and use Navidrome

Docker (compose)

One easy way to use or test Navidrome is with docker and docker-compose.

version: "3.1"
services:
  navidrome:
    image: deluan/navidrome:latest
    user: 1000:1000 # should be owner of volumes
    ports:
      - "4533:4533"
    restart: unless-stopped
    environment:
      # Optional: put your config options customization here. Examples:
      ND_SCANSCHEDULE: 1h
      ND_LOGLEVEL: info  
      ND_SESSIONTIMEOUT: 24h
      ND_BASEURL: ""
    volumes:
      - "/path/to/data:/data"
      - "/path/to/your/music/folder:/music:ro"

Changes “/path/to/data” to the directory in where you wants to store the Navidrome data in the host computer and “/path/to/your/music/folder” to the directory that has all your music.

Binary Package

Install Navidrome like a native application using the binary pakage

The only prerequisite that Navidrome needs is ffmpeg to be installed in the system

sudo apt install ffmpeg

Create two directory to storage the executable and the database that Navidrome will use

sudo install -d -o $USER -g $USER /opt/navidrome
sudo install -d -o $USER -g $USER /var/lib/navidrome

Get the latest Navidrome release and move it to /opt/navidrome/

wget https://github.com/navidrome/navidrome/releases/download/v0.XX.0/navidrome_0.XX.0_Linux_x86_64.tar.gz -O Navidrome.tar.gz
sudo tar -xvzf Navidrome.tar.gz -C /opt/navidrome/
sudo chown -R $USER:$USER /opt/navidrome

Change the Navidrome number version before you use the wget command

In /var/lib/navidrome create a new file named navidrome.toml

sudo vim /var/lib/navidrome/navidrome.toml

Now add only this line in the file and change <music_path> to you music directory

MusicFolder = "<music_path>"

Start Navidrome with a systemd unit

Create a new file named navidrome.service

sudo vim /etc/systemd/system/navidrome.service

Copy and paste the following and change under Service and with your username and group

[Unit]
Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic
After=remote-fs.target network.target
AssertPathExists=/var/lib/navidrome

[Install]
WantedBy=multi-user.target

[Service]
User=<user>
Group=<group>
Type=simple
ExecStart=/opt/navidrome/navidrome --configfile "/var/lib/navidrome/navidrome.toml"
WorkingDirectory=/var/lib/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure

# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
ReadWritePaths=/var/lib/navidrome

# You can uncomment the following line if you're not using the jukebox This
# will prevent navidrome from accessing any real (physical) devices
#PrivateDevices=yes

# You can change the following line to `strict` instead of `full` if you don't
# want navidrome to be able to write anything on your filesystem outside of
# /var/lib/navidrome.
ProtectSystem=full

# You can uncomment the following line if you don't have any media in /home/*.
# This will prevent navidrome from ever reading/writing anything there.
#ProtectHome=true

# You can customize some Navidrome config options by setting environment variables here. Ex:
#Environment=ND_BASEURL="/navidrome"

Reload the service daemon and start the newly created service

sudo systemctl daemon-reload
sudo systemctl start navidrome.service
sudo systemctl status navidrome.service

If the service has started correctly verify you can access http://localhost:4533 or using the ip address of the computer in that you use to install it and follow the instructions to setup Navidrome

If everything is working, now enable the daemon to start Navidrome at boot

sudo systemctl enable navidrome.service

Apps

There are several apps to use with Navidrome, here is a short list of the apps i use:

For more information check the documentation

Navidrome Documentation

Home  Linux  Notes  Blog Spot