Tag Archives: music

Navidrome

Navidrome Music Streamer

I've never used any streaming services and never will!

A friend uses/d Spotify and became uncomfortable with not owning any of the music which could also be taken away at will. So on my search for a good self hosted streaming service, I came across Navidrome.
After some reading I took the plunge. The purpose of this page is to walk through the installation process (gentoocentric).

A web server: apache

DNS
SSL Certs

I just did this is the user directory as we'll move the file elsewhere.

Build the binary:
$ git clone https://github.com/navidrome/navidrome
$ cd navidrome
$ make setup # Install build dependencies
$ make build # Build UI and server, generates a single executable
# mkdir /opt/navidrom /etc/navidrome/ /var/lib/navidrome /var/log/navidrome
# mv navidrome /opt/navidrome/navidrome
# chmod 644 /opt/navidrome/navidrome
# chmod 755 /opt/navidrome /etc/navidrome /var/lib/navidrome /var/log/navidrome
Create the config:
# vim /etc/navidrome/navidrome.ini

Scanner.Schedule = '@every 24h'
MusicFolder = '/path/to/Music'
DataFolder = '/var/lib/navidrome'
LogFile = '/var/log/navidrome/navidrome.log'
Address = <your listening ip>
Deezer.Enabled = false
Jellyfin.Enabled = false
LastFM.Enabled = false
ListenBrainz.Enabled = false
EnableScrobbleHistory = false
EnableSharing = false
EnforceNonRootUser = true
EnableTranscodingConfig = true
PasswordEncryptionKey = <some secret>
AuthRequestLimit = 5
AuthWindowLength = "20s"
/opt/navidrom/       # Binary location    
/etc/navidrome/ # Config location
/var/lib/navidrome/ # DB location
Create the systemd service:

# You will need to disable PasswordEncryptionKey and then re-enable before starting the service

# /opt/navidrome/navidrome service install -u apache -w /var/lib/navidrome/ -c /etc/navidrome/navidrome.ini
vim /etc/apache2/vhosts.d/00_default_ssl_vhost.conf

<VirtualHost *:443>
Header set Access-Control-Allow-Origin "<music.yourdomain.com>"
Include /etc/apache2/vhosts.d/default_vhost.include
##### CSP Content-Security-Policy #####
Header set X-Nonce "expr=%{base64:%{reqenv:UNIQUE_ID}}"
SSLEngine on
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

<Directory "/<webroot>/localhost/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
Options IncludesNoExec
ProxyRequests Off
ProxyPass / http://<listening IP>:4533/
ProxyPassReverse / http://<listening IP>:4533/
#RequestHeader set X-Forwarded-Proto http
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
SSLCertificateFile /path/to/fullchain.pem
SSLCertificateKeyFile /path/to/privkey.pem
ServerName music.yourdomain.com

<IfModule headers_module>
RequestHeader set X-HTTPS 1
</IfModule>
<Proxy https://music.yourdomain.com>
Header always set Access-Control-Allow-Origin "*"
</Proxy>
</VirtualHost>
# systemctl enable --now navidrome
# apachectl graceful

If all went well, open your browser to https://music.yourdomain.com.
Your first login will be the admin account

Further reading: The docs are really good, so read up here