‍Navidrome is a powerful music server that allows you to access your music collection from anywhere using a modern web interface and a variety of third-party mobile apps. In this article, we will guide you through the process of installing Navidrome on Rocky Linux 8. By following these steps, you will be able to enjoy your music library on any device with ease. So, let’s get started.

Prerequisites

Before we begin the installation, you need to ensure that you have the following prerequisites:

  • A system with Rocky Linux 8 installed and running.
  • Root access to the system.
  • Docker installed and running on your Rocky Linux 8 system.

If you haven’t installed Docker yet, you can refer to our guide on How to Install Docker on Rocky Linux 8 for detailed instructions.

Once you have fulfilled these prerequisites, we can proceed with the installation and configuration of Navidrome.

Step 1: Install Nginx

The first step is to install Nginx, which will act as a reverse proxy for Navidrome. You can install Nginx on Rocky Linux 8 by running the following commands:

yum install nginx -y
systemctl enable nginx
systemctl start nginx
systemctl status nginx

Step 2: Enable Firewall

Next, you need to enable the firewall to allow HTTP and HTTPS traffic. Run the following commands to enable the required services:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

Step 3: Install Let’s Encrypt SSL Certificate

To secure your Navidrome installation, we recommend using Let’s Encrypt SSL certificates. Follow the below steps to install the certificate:

  1. Install the EPEL repository and the mod_ssl package:
dnf install epel-release mod_ssl -y
  1. Install the Certbot client to manage the Let’s Encrypt certificates:
dnf install python3-certbot-nginx -y
  1. Issue the SSL certificate for your domain. Replace dev.domainhere.info and dev@dev.domainhere.info with your actual domain name and email address:
certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email dev@dev.domainhere.info -d dev.domainhere.info
  1. Restart Nginx to apply the changes:
systemctl restart nginx

Step 4: Configuring Nginx Server Blocks

Now, let’s configure the Nginx server blocks to properly route the traffic to Navidrome. Open the nginx.conf file:

nano /etc/nginx/nginx.conf

Replace the contents of the file with the following configuration:

# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
 worker_connections 1024;
}

http {
 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
 '$status $body_bytes_sent "$http_referer" '
 '"$http_user_agent" "$http_x_forwarded_for"';

 access_log /var/log/nginx/access.log main;

 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout 65;
 types_hash_max_size 2048;

 include /etc/nginx/mime.types;
 default_type application/octet-stream;

 # Load modular configuration files from the /etc/nginx/conf.d directory.
 # See http://nginx.org/en/docs/ngx_core_module.html#include
 # for more information.
 include /etc/nginx/conf.d/*.conf;
}

Save and exit the file by pressing Ctrl+O, followed by Ctrl+X.

Next, create a new Nginx configuration file for your domain:

vi /etc/nginx/conf.d/dev.conf

Add the following configuration to the file, replacing dev.domainhere.info and 192.169.7.180 with your actual domain name and IP address, and adjust the SSL paths accordingly:

upstream app {
server 192.169.7.180:4533;
}

server {
listen 80 default_server;
server_name dev.domainhere.info;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl; # managed by Certbot
# The host name to respond to
server_name dev.domainhere.info;

ssl_certificate /etc/letsencrypt/live/dev.domainhere.info/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dev.domainhere.info/privkey.pem; # managed by Certbot

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

location / {
proxy_pass http://app;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Real-Port $server_port;
proxy_set_header X-Real-Scheme $scheme;
}
}

Save and exit the file by pressing Esc, followed by :wq!, and then press Enter.

If you have SELinux enabled on your system, run the following command to allow Nginx to make network connections:

setsebool -P httpd_can_network_connect 1

Finally, restart Nginx to apply the changes:

systemctl restart nginx
systemctl status nginx

Step 5: Enable Port 4533

To enable communication with Navidrome through the firewall, run the following commands:

firewall-cmd --zone=public --permanent --add-port4533/tcp
firewall-cmd --reload

Step 6: Install Navidrome with Docker

Now comes the exciting part – installing Navidrome using Docker. Run the following command to install Navidrome:

docker run -d \
--name navidrome \
--restart=unless-stopped \
--user $(id -u):$(id -g) \
-v /path/to/music:/music \
-v /path/to/data:/data \
-p 4533:4533 \
-e ND_LOGLEVEL=info \
deluan/navidrome:latest

Replace /path/to/music and /path/to/data with the actual paths where you want to store your music files and Navidrome data. Make sure to choose appropriate directories on your system.

The installation process will start, and Navidrome will be up and running in no time.

Step 7: Adding Music to Navidrome

To add your music files to Navidrome, follow these steps:

  1. Open a terminal window and log in to the Navidrome Docker container:
docker exec-it navidrome sh
  1. Change to the music directory:
cd /music
  1. Now, you can add your music files directly to the /music directory.

Step 8: Accessing Navidrome

Congratulations! You have successfully installed Navidrome on Rocky Linux 8. To access Navidrome, open your web browser and enter the IP address or domain name of your server, followed by https://dev.domainhere.info. Make sure to replace dev.domainhere.info with your actual IP address or domain name.

You will be redirected to the Navidrome web interface, where you can log in and start enjoying your music collection.

Conclusion

In this article, we have walked you through the process of installing Navidrome with Docker on Rocky Linux 8. By following these steps, you can set up a powerful music server that allows you to access your music collection from anywhere. With the help of Nginx as a reverse proxy and Let’s Encrypt SSL certificates, your Navidrome installation will be secure and accessible over HTTPS.

If you’re looking for reliable and scalable cloud hosting solutions, consider Shape.host’s Linux SSD VPS services. With Shape.host, you can experience high-performance cloud hosting tailored to your specific needs. Visit Shape.host for more information.