Posted on — Leave a comment

Installing Navidrome on Fedora Linux using Podman

Navidrome is an open-source music server that lets you stream your personal audio collection anywhere. It gives you freedom to listen to your music collection from any browser or mobile device. It’s like your personal Spotify!

In this guide, we will explore how to get Navidrome up and running securely using Podman on Fedora Linux. Best of all, because Navidrome builds official multi-architecture container images including, linux/amd64, linux/arm64, and linux/arm/v6/v7, this setup is highly portable. Whether your hardware is a standard x86 PC server or a low-powered ARM-based Raspberry Pi, this walk-through has you covered.

For the official image for Navidrome Music Server go to:

deluan/navidrome – Docker Image

Using the official container images with Podman and Podman Compose

Container images are available for the linux/amd64, linux/arm/v6, linux/arm/v7 and linux/arm64 platforms. They include everything needed to run Navidrome

[nico@stamfordbridge navidrome\]$ podman pull deluan/navidrome
✔ docker.io/deluan/navidrome:latest
Trying to pull docker.io/deluan/navidrome:latest…
Getting image source signatures
Copying blob 75c0824146ea done |
Copying blob 4f4fb700ef54 done |
Copying blob 4f4fb700ef54 done |
Copying blob e1dbf20ea67c done |
Copying blob 1cc3d825d8b2 done |
Copying config 0c9bad3bd7 done |
Writing manifest to image destination
0c9bad3bd7305815d56fe588a64f9172a8bb6aa2bfef3ad77e764c8694e7e860

If you have SELinux enabled on your Fedora Linux server, then add the container_file_t SELinux context to the Data and Music directories and its contents.

[nico@stamfordbridge navidrome]$ sudo semanage fcontext -a -t container_file_t '/home/nico/navidrome/Data(/.\*)?' [nico@stamfordbridge navidrome]$ sudo semanage fcontext -a -t container_file_t '/home/nico/navidrome/Music(/.\*)?'

Apply the SELinux policy to the Data and Music directories.

[nico@stamfordbridge navidrome]$ sudo restorecon -R /home/nico/navidrome/Data [nico@stamfordbridge navidrome]$ sudo restorecon -R /home/nico/navidrome/Music

Change the owner of the /home/nico/navidrome/Data and /home/nico/navidrome/Music to 1000.

[nico@stamfordbridge navidrome]$ podman unshare chown 1000:1000 /home/nico/navidrome/Data [nico@stamfordbridge navidrome]$ podman unshare chown 1000:1000 /home/nico/navidrome/Music

Using podman-compose :

Create a podman-compose.yml file with the following content (or add the navidrome service below to your existing file):

[nico@stamfordbridge navidrome]$ cat podman-compose.yml
version: "3"
services: navidrome: image: deluan/navidrome:latest user: 1000:1000 # should be owner of volumes ports: - "4533:4533" restart: unless-stopped environment: # Optional: put your config options customization here. Examples: ND_SCANSCHEDULE: 1h ND_LOGLEVEL: info ND_SESSIONTIMEOUT: 24h ND_BASEURL: "" volumes: - "/home/nico/navidrome/Data:/data" - "/home/nico/navidrome/Music:/music:ro"

Start the navidrome container with podman-compose up -d.

[nico@stamfordbridge navidrome]$ podman-compose up -d

Note that the environment variables above are just an example and are not required. The values in the example are already the defaults

Using podman command line tool:

[nico@stamfordbridge navidrome]$ podman run -d - name navidrome - restart=unless-stopped - user $(id -u):$(id -g) -v /home/ec2-user/navidrome/Music:/music -v /home/ec2-user/navidrome/Data:/data -p 4533:4533 -e ND_LOGLEVEL=info deluan/navidrome:latest
c00c31d49ec5e0f0a0141aef9e2b69abf6a1b5f0604515bc7111f3e0ef398237 [nico@stamfordbridge navidrome]$ podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c00c31d49ec5 docker.io/deluan/navidrome:latest 9 seconds ago Up 9 seconds 0.0.0.0:4533->4533/tcp navidrome

Customization

  • The user argument should ideally reflect the UID:GID of the owner of the music library to avoid permission issues. For testing purposes you could omit this directive, but as a rule of thumb you should not run a production container as root.
  • Remember to change the volumes paths to point to your local paths. /data is where Navidrome will store its DB and cache, /music is where your music files are stored.
  • Configuration options can be customized with environment variables as needed. For podman-compose just add them to the environment section or the yml file. For podman CLI use the -e parameter. e.g.: -e ND_SESSIONTIMEOUT=24h.
  • If you want to use a configuration file with Navidrome running in Podman, you can create a navidrome.toml config file in the /data folder and set the option ND_CONFIGFILE=/data/navidrome.toml.
Posted on — Leave a comment

Playing Music on your Fedora Terminal with MPD and ncmpcpp

MPD, as the name implies, is a Music Playing Daemon. It can play music but, being a daemon, any piece of software can interface with it and play sounds, including some CLI clients.

One of them is called ncmpcpp, which is an improvement over the pre-existing ncmpc tool. The name change doesn’t have much to do with the language they’re written in: they’re both C++, but ncmpcpp is called that because it’s the NCurses Music Playing Client Plus Plus.

Installing MPD and ncmpcpp

The ncmpmpcc client can be installed from the official Fedora repositories with DNF directly with

$ sudo dnf install ncmpcpp

On the other hand, MPD has to be installed from the RPMFusion free repositories, which you can enable, as per the official installation instructions, by running

$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

and then you can install MPD by running

$ sudo dnf install mpd

Configuring and Starting MPD

The most painless way to set up MPD is to run it as a regular user. The default is to run it as the dedicated mpd user, but that causes all sorts of issues with permissions.

Before we can run it, we need to create a local config file that will allow it to run as a regular user.

To do that, create a subdirectory called mpd in ~/.config:

$ mkdir ~/.config/mpd

copy the default config file into this directory:

$ cp /etc/mpd.conf ~/.config/mpd

and then edit it with a text editor like vim, nano or gedit:

$ nano ~/.config/mpd/mpd.conf

I recommend you read through all of it to check if there’s anything you need to do, but for most setups you can delete everything and just leave the following:

db_file "~/.config/mpd/mpd.db" log_file "syslog"

At this point you should be able to just run

$ mpd

with no errors, which will start the MPD daemon in the background.

Using ncmpcpp

Simply run

$ ncmpcpp

and you’ll see a ncurses-powered graphical user interface in your terminal.

Press 4 and you should see your local music library, be able to change the selection using the arrow keys and press Enter to play a song.

Doing this multiple times will create a playlist, which allows you to move to the next track using the > button (not the right arrow, the > closing angle bracket character) and go back to the previous track with <. The + and – buttons increase and decrease volume. The Q button quits ncmpcpp but it doesn’t stop the music. You can play and pause with P.

You can see the current playlist by pressing the 1 button (this is the default view). From this view you can press i to look at the information (tags) about the current song. You can change the tags of the currently playing (or paused) song by pressing 6.

Pressing the \ button will add (or remove) an informative panel at the top of the view. In the top left, you should see something that looks like this:

[------]

Pressing the r, z, y, R, x buttons will respectively toggle the repeat, random, single, consume and crossfade playback modes and will replace one of the – characters in that little indicator to the initial of the selected mode.

Pressing the F1 button will display some help text, which contains a list of keybindings, so there’s no need to write a complete list here. So now go on, be geeky, and play all your music from your terminal!