Install GNUMP3d - A Streaming Media Server in RHEL/CentOS/Fedora and Ubuntu/Debian


Introduction

GNUMP3d is a lightweight and easy-to-use streaming media server that allows users to share and stream their music collection over the internet. It supports various platforms, including RHEL, CentOS, Fedora, Ubuntu, and Debian. In this article, we will guide you through the installation process of GNUMP3d on these Linux distributions, along with several examples and their outputs.

Prerequisites

Before we proceed with the installation, make sure you have the following prerequisites −

  • A running instance of RHEL, CentOS, Fedora, Ubuntu, or Debian.

  • A user account with sudo privileges.

Installation

To install GNUMP3d, follow the steps below for your respective Linux distribution −

RHEL, CentOS, and Fedora

Open a terminal and update the system's package repository −

sudo yum update

Install GNUMP3d using the package manager −

sudo yum install gnump3d

Ubuntu and Debian

Open a terminal and update the system's package repository −

Example 

sudo apt update

Install GNUMP3d using the package manager −

sudo apt install gnump3d

Output 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
   apache2 apache2-bin apache2-data apache2-utils flac imagemagick libapache2-mod-php libapache2-mod-wsgi-py3 libavcodec-extra58
   libavdevice58 libavfilter-extra7 libavformat58 libavresample4 libavutil56 libcddb2 libflac8 libgomp1 libimage-magick-perl
Suggested packages:
   apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser imagemagick-doc libmagickcore-perl
   libphp-xml-rss | libphp-pear libmail-box-perl libstring-crc32-perl libvorbisidec1 timidity
The following NEW packages will be installed:
   apache2 apache2-bin apache2-data apache2-utils flac gnump3d imagemagick libapache2-mod-php libapache2-mod-wsgi-py3
   libavcodec-extra58 libavdevice58 libavfilter-extra7 libavformat58 libavresample4 libavutil56 libcddb2 libflac8 libgomp1
   vlc-plugin-notify vlc-plugin-qt vlc-plugin-samba vlc-plugin-skins2 vlc-plugin-video-output vlc-plugin-video-splitter
   vlc-plugin-visualization
0 upgraded, 78 newly installed, 0 to remove and 0 not upgraded.
Need to get 47.0 MB/61.3 MB of archives.
After this operation, 315 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Configuration

After the installation, GNUMP3d needs to be configured to serve your music collection. The configuration file can be found at /etc/gnump3d/gnump3d.conf. Open the file using a text editor and make the necessary changes according to your preferences.

Here are some important configuration options −

  • musicdir − Specifies the directory where your music collection is located.

  • port − Defines the port number on which GNUMP3d will listen for incoming connections.

  • bindaddr − Sets the IP address on which GNUMP3d will bind.

Once you've made the required changes, save the file and exit the text editor.

Starting GNUMP3d

To start GNUMP3d, run the following command in the terminal −

sudo systemctl start gnump3d

By default, GNUMP3d will start serving music from the configured music directory on the specified port. You can access the server through a web browser by entering the server's IP address or hostname followed by the port number.

Use Cases

Accessing GNUMP3d Server

Assuming the GNUMP3d server is running on the local machine with the default port (8888), open a web browser and enter the following URL −

http://localhost:8888

Changing the Music Directory

To change the music directory, modify the musicdir option in the configuration file (/etc/gnump3d/gnump3d.conf). For example, if your music is located in /home/user/Music, change the line to −

musicdir = /home/user/Music

Save the file and restart GNUMP3d using the following command −

sudo systemctl restart gnump3d

Restricting Access with User Authentication

GNUMP3d allows you to restrict access to your music collection by enabling user authentication. Open the configuration file (/etc/gnump3d/gnump3d.conf) and set the following options −

Example 

authentication = 1
userfile = /etc/gnump3d/users

Save the file and create a user file by running the command −

sudo htpasswd -c /etc/gnump3d/users username

Output 

New password: 
Re-type new password: 
Adding password for user username

Replace username with the desired username. You will be prompted to enter and confirm the password.

Restart GNUMP3d to apply the changes −

sudo systemctl restart gnump3d

Advanced Configuration and Customization

GNUMP3d provides various advanced configuration options that allow you to customize and enhance your streaming media server. Here are a few examples −

Changing the Server Port

By default, GNUMP3d listens on port 8888. However, if you want to change the port number, open the configuration file (/etc/gnump3d/gnump3d.conf) and modify the following line −

port = 8888

Replace 8888 with your desired port number. Save the file and restart GNUMP3d for the changes to take effect.

Customizing the Appearance

GNUMP3d allows you to customize the appearance of the web interface. You can modify the CSS styles and HTML templates to match your preferences. Locate the template_dir option in the configuration file and set it to the desired template directory. For example −

template_dir = /path/to/custom/templates

Create the directory specified and copy the default templates from /usr/share/gnump3d/templates to your custom directory. Then, modify the templates as per your requirements.

Enabling Streaming of Other Media Types

By default, GNUMP3d is configured to stream MP3 files. However, you can enable streaming of other media types such as OGG, FLAC, or WAV. Open the configuration file and find the types option. Add or uncomment the relevant file extensions. For example −

types = mp3,ogg,flac,wav

Save the file and restart GNUMP3d for the changes to take effect.

Troubleshooting

If you encounter any issues during the installation or configuration of GNUMP3d, here are a few troubleshooting tips −

Check the log files − GNUMP3d logs its activities to the system log. You can view the logs using the following command −

Example 

sudo journalctl -u gnump3d

This will display the recent log entries for GNUMP3d.

Output 

-- Logs begin at Mon 2023-06-26 10:00:00 UTC, end at Mon 2023-06-26 11:00:00 UTC. --
Jun 26 10:30:00 hostname systemd[1]: Started GNU MP3 Daemon.
Jun 26 10:30:00 hostname gnump3d[1234]: Starting GNU MP3 Daemon...
Jun 26 10:30:01 hostname gnump3d[1234]: GNU MP3 Daemon started successfully.
Jun 26 10:30:05 hostname gnump3d[1234]: Processing directory: /var/music
Jun 26 10:30:10 hostname gnump3d[1234]: Processing directory: /var/music/rock
Jun 26 10:30:15 hostname gnump3d[1234]: Processing directory: /var/music/jazz
Jun 26 10:30:20 hostname gnump3d[1234]: GNU MP3 Daemon is now ready to serve requests.
Jun 26 10:45:00 hostname gnump3d[1234]: Received SIGTERM signal. Shutting down...
Jun 26 10:45:00 hostname gnump3d[1234]: Stopped GNU MP3 Daemon.
Jun 26 10:45:00 hostname systemd[1]: Stopped GNU MP3 Daemon.

Verify firewall settings − Ensure that the firewall on your Linux distribution allows incoming connections to the GNUMP3d port (default: 8888). You may need to add a firewall rule to allow access.

Validate the music directory − Double-check that the musicdir option in the configuration file points to the correct directory where your music collection is located. Ensure that the directory and files have proper read permissions.

Restart the GNUMP3d service − If you make any changes to the configuration file, remember to restart the GNUMP3d service for the changes to take effect −

sudo systemctl restart gnump3d

Conclusion

In this article, we have covered the installation of GNUMP3d on RHEL, CentOS, Fedora, Ubuntu, and Debian. We have also explored various examples and their outputs, along with advanced configuration options and troubleshooting tips. With GNUMP3d, you can easily create your streaming media server and enjoy seamless access to your music collection over the internet.

Updated on: 17-Jul-2023

85 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements