Comprehensive Guide to Installing Navidrome on Linux

Navidrome is a modern, open-source music server and streamer compatible with Subsonic/Airsonic clients. This guide will walk you through the process of installing and configuring Navidrome on a Linux system, allowing you to host your own music streaming service.

Prerequisites

Before we begin, ensure you have:

  1. A Linux server (this guide uses Ubuntu 20.04 LTS, but can be adapted for other distributions)
  2. Root or sudo access to your server
  3. Basic knowledge of command-line operations
  4. A directory with your music files

Need a reliable server to host your Navidrome instance? Check out Servers Guru for high-performance servers optimized for media streaming applications.

Step 1: Update Your System

First, let’s ensure your system is up-to-date:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Dependencies

Navidrome requires some additional packages:

sudo apt install -y curl ffmpeg

Step 3: Download Navidrome

Create a directory for Navidrome and download the latest release:

sudo mkdir -p /opt/navidrome
cd /opt/navidrome
sudo curl -L "https://github.com/navidrome/navidrome/releases/latest/download/navidrome_linux_amd64.tar.gz" | sudo tar -xz

Step 4: Create a Dedicated User

It’s a good practice to run Navidrome under a dedicated user:

sudo useradd -r -s /usr/sbin/nologin -d /opt/navidrome navidrome
sudo chown -R navidrome:navidrome /opt/navidrome

Step 5: Configure Navidrome

Create a configuration file:

sudo nano /opt/navidrome/navidrome.toml

Add the following content, adjusting paths as necessary:

MusicFolder = "/path/to/your/music"
DataFolder = "/var/lib/navidrome"
Port = 4533
Address = "0.0.0.0"
ScanSchedule = "@every 1h"
TranscodingCacheSize = "150MiB"

Create the data folder and set permissions:

sudo mkdir -p /var/lib/navidrome
sudo chown navidrome:navidrome /var/lib/navidrome

Step 6: Create a Systemd Service

Create a systemd service file to manage Navidrome:

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

Add the following content:

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

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

[Install]
WantedBy=multi-user.target

Step 7: Start and Enable Navidrome

Reload systemd, then start and enable the Navidrome service:

sudo systemctl daemon-reload
sudo systemctl start navidrome
sudo systemctl enable navidrome

Step 8: Set Up Reverse Proxy (Optional)

For better security and to use a domain name, you can set up a reverse proxy with Nginx:

Install Nginx:

sudo apt install nginx

Create a new Nginx configuration file:

sudo nano /etc/nginx/sites-available/navidrome

Add the following content (replace your_domain.com with your actual domain):

server {
    listen 80;
    server_name your_domain.com;

    location / {
        proxy_pass http://localhost:4533;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # WebSocket support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/navidrome /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Step 9: Secure with Let’s Encrypt (Optional)

If you’ve set up Nginx, you can secure your Navidrome instance with a free SSL certificate from Let’s Encrypt:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your_domain.com

Follow the prompts to complete the certificate installation.

Step 10: First-Time Setup

Access Navidrome by navigating to http://your_server_ip:4533 (or https://your_domain.com if you set up Nginx and SSL). Create your admin account and start enjoying your music!

Optimizing Your Navidrome Instance

For the best performance:

  1. Allocate Sufficient Resources: Ensure your server has enough CPU and RAM, especially if you have a large music library. Servers Guru offers a range of high-performance options suitable for hosting media streaming applications like Navidrome.

  2. SSD Storage: For faster library scanning and improved response times, consider using SSD storage for your music files and Navidrome data folder.

  3. Transcoding Settings: Adjust the transcoding settings based on your server’s capabilities and your bandwidth requirements.

  4. Regular Backups: Implement a robust backup strategy for your music files and Navidrome data folder.

  5. Keep Updated: Regularly update Navidrome to benefit from the latest features and security improvements.

By following this guide, you now have your own Navidrome instance running on Linux. This setup allows you to stream your personal music collection from anywhere, using a variety of Subsonic-compatible apps. Remember to keep your instance updated and secure.

Enjoy your personal music streaming service!