🎵 My Weekend Project: Building a Raspberry Pi Music Server with Navidrome
Turning an old Raspberry Pi into my personal streaming service—with a little help from AI
For years, my digital music collection has been scattered across old hard drives and trapped inside proprietary apps. I wanted a way to liberate my library and create my own personal, self-hosted streaming service—like a private Spotify—that I could access from any device in my home. After some research, I landed on the perfect project: using a Raspberry Pi and a fantastic piece of open-source software called Navidrome.
💡 The Secret Weapon: What could have been a frustrating project, potentially spanning days of searching through forums, was condensed into a single weekend. I had an AI assistant, Gemini, integrated right into my Chrome browser. Every time I hit a wall or needed a command, I could simply highlight text on a setup guide or ask a question in the side panel. It was like having an expert looking over my shoulder, turning days of work into just a few hours.
Here's a look at my journey.
🛠️ What You'll Need (The Hardware & Software)
This project doesn't require a top-of-the-line machine. In fact, I used an older Raspberry Pi that was perfect for the job.
🔌 Hardware:
- ▸ Raspberry Pi: I used a Raspberry Pi 3 Model B. A newer model would be even faster, but the 3B is more than capable.
- ▸ Storage for the OS: Instead of a standard microSD card, I opted to run the operating system from an SSD in a tiny USB case. This is a huge performance upgrade that makes the whole system feel much snappier.
- ▸ Storage for Music: A separate external USB hard drive to hold the actual MP3 files.
- ▸ Power Supply & Cables: A proper power supply for the Pi and an Ethernet cable for the most stable network connection.
💻 Software:
- ▸ Raspberry Pi OS: The official operating system. I used the Raspberry Pi Imager to easily flash it onto my SSD.
- ▸ Navidrome: The star of the show. It's a lightweight, open-source music server.
- ▸ An SSH Client: To connect to the Pi from my main computer. On Windows, the built-in Windows Terminal is perfect.
- ▸ Docker: To run Navidrome in a clean, manageable container.
📝 The Step-by-Step Process
With my hardware ready and the Raspberry Pi OS booted up, it was time to get everything running. My first step was connecting to the Pi from my desktop computer using SSH, which is a way to get a command-line interface without needing a separate monitor and keyboard for the Pi.
ssh pi@<RASPBERRY_PI_IP_ADDRESS>
Once I was in, the real work began.
1️⃣ System Update and Docker Installation
First, I made sure all the system packages were up to date.
sudo apt update && sudo apt upgrade -y
Next, I installed Docker, which is a modern way to run applications in isolated environments called containers. This keeps the setup clean and easy to manage.
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi
2️⃣ Preparing the Music Drive and Folders
I plugged my external USB drive full of music into the Pi. I created a dedicated folder on it for Navidrome to store its data and configuration. I also made a directory on the Pi that would serve as the "mount point" for the music.
# Create a folder for Navidrome's data
mkdir /home/pi/navidrome-data
# Create a folder where the music will be accessed
sudo mkdir /media/music
I then configured the Pi to automatically "mount" the external music drive to that /media/music folder every time it boots up. This way, Navidrome always knows where to find the tunes.
3️⃣ Configuring and Launching Navidrome
This is where the magic happens. I created a simple text file called docker-compose.yml to tell Docker exactly how to run Navidrome.
version: "3"
services:
navidrome:
image: deluan/navidrome:latest
user: 1000:1000 # The user ID and group ID
ports:
- "4533:4533"
restart: unless-stopped
environment:
# Optional: Music folder scan interval
ND_SCANINTERVAL: 1h
# Optional: Log level
ND_LOGLEVEL: info
volumes:
- "/home/pi/navidrome-data:/data"
- "/media/music:/music:ro" # 'ro' means read-only
With the file saved, I launched the container with a single command:
docker-compose up -d
✅ Success! After a minute, I could open a web browser on my computer and navigate to http://<YOUR_PI_IP_ADDRESS>:4533. I was greeted with the Navidrome setup screen, created my admin user, and watched as it started scanning my entire music library, pulling in album art and track information automatically. It was working!
🔧 Troubleshooting Journey & Lessons Learned
Of course, no project is without its hurdles. This is where having Gemini in my browser was a lifesaver.
⚠️ Problem 1: Getting a Stable IP Address
I noticed that my Pi's IP address could change whenever I rebooted my router. For a server, you need a permanent, predictable address. I logged into my router's admin page, but I was a bit lost.
💡 The Solution: Using Gemini, I learned about DHCP Reservation. I found the setting in my router, and assigned a static IP address to the Pi's unique MAC address. Now, my Pi is always at 192.168.1.211, making it easy to find.
🚨 Problem 2: The Security Concern—Exposing It to the Internet
I was so excited that I wanted to access my music from outside my home network. My first thought was simple port forwarding.
⚠️ Security Warning: I asked Gemini about the next steps, and it immediately pointed out a major security risk: my connection was using http, meaning my password would be sent in plain text over the internet. The proper fix was to use https with a reverse proxy. This sounded complicated, but Gemini walked me through the entire process using an amazing tool called Caddy.
🌐 Problem 3: Setting up a DDNS and Troubleshooting Caddy
To get a secure https certificate, I needed a domain name. Gemini guided me to a free Dynamic DNS (DDNS) service called Dynu. Once I had my free domain (gygeek-music.freeddns.org), I needed to install a client on the Pi to keep the IP address updated.
Then came the Caddy setup. I installed it, but when I tried to load my configuration, it failed.
gygeek@raspberrypi:~$ sudo systemctl reload caddy
Job for caddy.service failed.
See "systemctl status caddy.service" and "journalctl -xe" for details.
Instead of panicking, I followed the error's advice and asked Gemini to interpret the output of sudo systemctl status caddy.service. The logs instantly revealed the problem:
Error: adapting config using caddyfile: /etc/caddy/Caddyfile: 12: unrecognized directive: {reverse_proxy
🔍 The Issue: The issue was a simple syntax error. The opening curly brace { needed to be on the same line as the domain name. I had it on a separate line.
❌ Incorrect:
gygeek-music.freeddns.org
{
reverse_proxy localhost:4533
}
✅ Correct:
gygeek-music.freeddns.org {
reverse_proxy localhost:4533
}
With that one-character fix, I reloaded Caddy, and it worked perfectly. I could now access my music securely from anywhere at https://gygeek-music.freeddns.org.
🎉 Conclusion: My Music, My Rules
This weekend project was a huge success. I now have a silent, low-power music server running 24/7, serving up my entire library to my phone, laptop, and smart speakers. The final result is a fast, beautiful web interface that feels just like a commercial service, but it's all mine—no ads, no subscriptions, and complete control.
If you've been thinking about a similar project but feel intimidated, I can't recommend it enough. With tools like Raspberry Pi, Navidrome, and an AI assistant to help you through the rough patches, building your own corner of the internet is more accessible than ever.
No comments:
Post a Comment