How to Create Your Own Music Server Just Like Spotify.

With a containerized Navidrome Music Server!

Do you want to create your very own private music server? One that works a lot like Spotify? Did you know that you can do all this in Linux? If you create a cloud server, you can share your music in the car with your friends and family and stream it to your mobile phone,  TV, or games console!

This is quite a long procedure, so grab a drink, perhaps a tea or coffee.

In this procedure, you will learn how to deploy a cloud VPS server running Debian, install Portainer to easily manage Docker containers, run the Navidrome music server in a container, and configure it for cloud access.

Navidrome

Step 1 – Deploy a Cloud Music Server Running Debian 11

You can choose any cloud provider you want, or if you prefer, you can host locally. For this example, I will be deploying my server on Atlantic.Net. I think they are a great provider. You get a fast server with SSD and lots of storage for not a lot of money.

To create an Atlantic.Net account, you can follow these steps:

  1. Go to the Atlantic.Net website at https://www.atlantic.net/ and click on the “Sign Up” button in the top right corner of the page.
  2. On the sign-up page, fill in your information, including your name, email address, and password. You will also need to select a security question and provide an answer.
  3. Review the terms and conditions and privacy policy, and then click on the “Create Account” button to submit your registration.
  4. Once you have submitted your registration, you will receive an email from Atlantic.Net with a link to activate your account. Click on the link in the email to activate your account.
  5. Once your account is activated, you can log in to the Atlantic.Net Cloud Control Panel to create and manage your cloud servers and other services.

You may need to provide additional information, such as your billing information and verification documents, to complete your registration and start using Atlantic.Net services.

Step 1.1 – Log in to your Atlantic.Net Account

Click the following link to be directed to the Login page. Fill in your details to log in.

Step 1.2 – Create a Debian Instance on Atlantic.Net for your Music Server

Now it’s time to build it; in this example, we will install Ubuntu 22.04 LTS 64bit 

  • Click on the “Add Server” button to create a new cloud server.

  • On the “Add a Server” page, type a name for your server.
  • Scroll down to find the Ubuntu operating system and click the “Debian” button to see the versions. We installed 11.6.0 64-bit; select it and continue.

  • Choose the region that you want to use for your Ubuntu instance. In this example, we will use USA-East-3 (Ashburn, VA).

  • Choose the payment term: on-demand, one year, or three years. Various discounts are available, but we will choose on-demand for added flexibility.

  • Choose the instance plan. Portainer recommends at least 4GB RAM (more for production workloads). In this demo, we will choose the G3.4GB plan

  • You can also select additional options, such as backups and IPV6, and add your own SSH keys if needed.
  • When you have selected everything you need, click the โ€œCreate Serverโ€ button.

  • Wait about 30 seconds for your server to be created. Once your server is ready, you can log in to it using SSH and start using it. The credentials are provided on screen and emailed to the primary email address on your account.

Step 2 – Install Portainer on Debian

Portainer is a lightweight container management tool that greatly simplifies the deployment of containers on Linux. It’s easy to manage and really powerful. We will use Portainer to manage containers, and we will deploy the Navidrome music server as a container running on Portainer.

Step 2.1 – Update Debian and Install Docker

First SSH to your Debian instance. If you are using Atlantic.Net cloud they will email you the root username and password. I will assume you have root access for this procedure – otherwise, you will need to use sudo.

First Update Debian

Bash
apt-get update -y  

Before installing Portainer, Docker CE must be installed on your server. You can install Docker CE by following the below steps. If you encounter any issues, check out the official documentation โ€“ itโ€™s likely theyโ€™ve changed something.

Install the required dependencies:

Bash
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg

Bash
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Next, update the repository and install Docker CE with the following command:

Bash
apt-get install docker-ce docker-ce-cli containerd.io -y

Once Docker is installed, verify the Docker installation using the following command:

Bash
docker version

Step 2.2 โ€“ Install Docker Compose (optional)

You will also need to install Docker Compose to your system. First, download the latest version of Docker Compose binary using the following command:

Bash
wget https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64

Next, copy the downloaded binary to the system path:

Bash
cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose

Next, set executable permissions to the Docker Compose binary:

Bash
chmod +x /usr/local/bin/docker-compose

Next, verify the Docker Compose installation using the following command:

Bash
docker-compose --version

Step 2.3 โ€“ Install Portainer UI

First, create a volume to store Portainer docker data using the following command:

Elsewhere On TurboGeek:  Understanding Red Hat File System Permissions

Bash
docker volume create portainer_data

Next, run the following command to download the Portainer image from the Docker Hub registry, create a container, and expose the container on port 9000:

Bash
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

You can verify the running container using the following command:

Bash
docker ps

Step 2.4 โ€“ Access Portainer UI

Now, open your web browser and access the Portainer UI IP address. Use the URL http://your-server-ip:9000. You should see the following page:

Set your admin user and password and click on the Create user button. You will be asked to select the Docker environment that you want to manage:

Select the local environment and click on the Connect button. You should see the Portainer UI on the following page:

Step 3 – Deploy a Navidrome Music Server container on Portainer

Navidrome Music Server Front Page

The next step is to deploy the Navidrome music server using Portainer.  Portainer makes this process super simple. Simply log into your Portainer URL and do the following.

Click on Stacks > Create Stacks, and then on the Web Editor Tab, add the following YAML.

The important bits to remember are the ports you want to use, I will use the defaults of 4553:4533

You will see that I have added a data volume and a music volume to the volumes local to the Portainer host.

YAML
version: "3"
services:
  navidrome:
    container_name: navidrome
    image: deluan/navidrome:latest
    ports:
      - "4533:4533"
    environment:
      # Optional: put your config options customization here. Examples:
      ND_SCANSCHEDULE: 1h
      ND_LOGLEVEL: info  
      ND_BASEURL: ""
    volumes:
      - "/data/navi:/data"
      - "/music:/music:ro"

To continue, click on Deploy The Stack

Once deployed, click on the containers tab to see the status of your container. It should say HEALTHY. If you click on the port numbers (not shown in the screenshot below) it will take you directly to your container URL and to the Navidrome Music Server GUI

Step 4 – Configure Navidrome Music Server and Upload Your Music

Now that Portainer is running,  we need to access the GUI and start uploading our music. You can start uploading straight away, but if (like me) your music collection is not well labeled, you may want to use a tool called Beats to sort out your music. Beets is out of the scope of this procedure,  but we will add a how-to for Beets another day.

Step 4.1 Upload Your Music

You will need to upload your music to your Debian host. The easiest way to do this is to use an FTP client. My favorite client is WINSCP.

  • Go to the WinSCP website (https://winscp.net/eng/download.php) and download the latest version of WinSCP.
  • Run the installer and follow the on-screen instructions to install WinSCP on your computer.

4.11 Install WiNSCP

  1. Launch WinSCP:
    • Once installed, launch WinSCP by double-clicking on the desktop shortcut or searching for it in your computer’s applications menu.
  2. Configure Connection Settings:
    • Upon launching WinSCP, you’ll be presented with the login screen.
    • Fill in the following details:
      • File protocol: Select either “SCP” or “SFTP” depending on your server’s configuration.
      • Hostname: Enter the IP address or domain name of the server you want to connect to.
      • Port number: Specify the port number for the connection. Usually, port 22 is used for SSH/SFTP connections.
      • Username: Provide your username for the server.
      • Password: Enter your password associated with the provided username.
      • Private key: If your server requires a private key for authentication, you can specify it here.
    • Once you’ve filled in all the required details, click on the “Save” button to save your session for future use.
  3. Connect to the Server:
    • After saving your session, click on the “Login” button to initiate the connection to the server.
    • WinSCP will attempt to establish a connection using the provided credentials. If successful, you will be logged in to the server, and you’ll see the remote file system on the right-hand side of the WinSCP window.
  4. Navigate and Transfer Files:
    • You can now navigate through the remote file system on the right-hand side and your local file system on the left-hand side of the WinSCP window.
    • To transfer files between your local machine and the server, simply drag and drop files or folders between the two panels.
  5. Disconnect from the Server:
    • Once you’ve finished transferring files or working on the server, you can disconnect from the server by clicking on the “Session” menu and selecting “Disconnect” or simply closing the WinSCP window.

Step 4.2 Installing Beets Music Server Sorter in Portainer:

  1. Access Portainer: Log in to your Portainer instance using your web browser.
  2. Create a New Stack: In the Portainer dashboard, navigate to the “Stacks” section and click on “Add Stack.”
  3. Define Stack Name: Give your stack a name, such as “Beets.”
  4. Compose File: In the stack creation page, switch to the “Web editor” tab to create a Compose file for your Beets installation.
  5. Compose Configuration: Enter the following configuration for Beets:

YAML
version: '3.8'

services:
  beets:
    image: linuxserver/beets
    container_name: beets
    volumes:
      - /path/to/your/music/library:/config
      - /path/to/your/music/library:/music
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Your/Timezone
    ports:
      - 8337:8337
    restart: unless-stopped

Make sure to replace “/path/to/your/music/library” with the actual path to your music library and “Your/Timezone” with your timezone.

  1. Deploy Stack: Once you’ve configured the Compose file, click on “Deploy the stack” to initiate the deployment process.
  2. Access Beets Web Interface: After deployment, access the Beets web interface by navigating to http://your-server-ip:8337 your web browser, or you can access the container shell directly from Portainer.

Step 4.2 Using Beets to Correct Music Titles and Metadata:

  1. Configure Beets:
    • Before using Beets, you’ll need to configure it. Beets uses a configuration file called config.yaml. You can generate a default configuration file by running:
    • beet config -i
    • This will create a config.yaml file in your home directory (~/.config/beets/config.yaml on Unix-like systems). You can edit this file to customize Beets’ behavior according to your preferences and needs.
  2. Import Music into Beets:
    • Once Beets is installed and configured, you can import your music collection by running:arduinoCopy codebeet import /path/to/your/music
    • Replace /path/to/your/music with the directory where your music files are located. Beets will scan this directory and its subdirectories, identify the music files, and add them to its database.
  3. Fix Music Metadata:
    • Beets can automatically correct and standardize the metadata (tags) of your music files based on online sources such as MusicBrainz and Discogs. To do this, run:sqlCopy codebeet fetch -af
    • This command will fetch metadata for your music files and apply any necessary corrections or updates.
  4. Organize Music Files:
    • Beets can also organize your music files into a structured directory hierarchy based on their metadata. To do this, run:arduinoCopy codebeet move
    • Beets will move and rename your music files according to the configuration specified in your config.yaml file.
  5. Customize Configuration (Optional):
    • You can customize Beets’ behavior further by modifying the config.yaml file. This includes specifying preferred metadata sources, defining file organization patterns, configuring plugins, and more.
  6. Additional Commands:
    • Beets offers many other commands and options for managing your music collection, such as beet ls to list your library, beet stats to display statistics about your library, and beet modify to manually edit metadata.
  7. Enjoy Your Organized Music Collection:
    • Once you’ve completed the necessary steps and customized Beets to your liking, you can enjoy your neatly organized music collection with accurate metadata.
Elsewhere On TurboGeek:  Installing and Using the Alation Data Catalog

Step 5 – Stream Music to your Cell Phone with SubStreamer

You can now stream music from the Web browser, which is great, but what’s better is when you stream it to your mobile (cell) phone. I like an app called SubStreamer, but there are literally hundreds of compatible apps you can use, so just dig around if you want to use something else.

  1. Download SubStreamer Mobile App:
    • Go to the App Store (for iOS devices) or Google Play Store (for Android devices).
    • Search for “SubStreamer” and download the app developed by Nils Kokemohr.
  2. Install the App:
    • Once the download is complete, install the SubStreamer app on your mobile device.
  3. Launch the App:
    • Open the SubStreamer app from your device’s home screen.
  4. Add Server:
    • Tap on the “Servers” tab at the bottom of the screen.
  5. Configure Server Connection:
    • Tap on the “+” icon to add a new server.
    • Enter the following information:
      • Server Name: A name to identify your Navidrome music server.
      • Server URL: Enter the URL or IP address of your Navidrome music server.
      • Username: Your Navidrome music server username.
      • Password: Your Navidrome music server password.
      • Port: The port number Navidrome music server is running on (default is usually 4533).
      • Path: (Optional) If your Navidrome server is hosted on a subdirectory, enter the path here.
  6. Save and Connect:
    • Tap on “Save” or “Connect” to save the server configuration and attempt to connect to your Navidrome server.
  7. Verify Connection:
    • Once saved, the SubStreamer app will attempt to connect to your Navidrome server.
    • If the connection is successful, you should see your music library and other available options within the app.
  8. Enjoy Your Music:
    • You can now browse and stream your music collection from your Navidrome music server using the SubStreamer mobile app.

Richard.Bailey

Richard Bailey, a seasoned tech enthusiast, combines a passion for innovation with a knack for simplifying complex concepts. With over a decade in the industry, he's pioneered transformative solutions, blending creativity with technical prowess. An avid writer, Richard's articles resonate with readers, offering insightful perspectives that bridge the gap between technology and everyday life. His commitment to excellence and tireless pursuit of knowledge continues to inspire and shape the tech landscape.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate ยป