How to Setup Icecast Server on AlmaLinux 8

a) Installing Tools & Dependencies

Install the Development Tools group.
sudo dnf groupinstall "Development Tools"
Then install the following dependencies:

  • curl-devel
  • libtheora-devel
  • libvorbis-devel
  • libxslt-devel
  • speex-devel
  • libshout

sudo dnf install curl-devel libtheora-devel libvorbis-devel libxslt-devel speex-devel libshout

b) Building & Installing The Icecast

Download the archive file of the Icecast‘s source code. Prefer the latest version if available.
Then extract the archive file and enter into the extracted directory.
tar -zxvf ./icecast-2.4.4.tar.gz
cd ./icecast-2.4.4
Now, prepare the environment for building.
./configure --sysconfdir=/etc --localstatedir=/var
Let’s build !
And install it into your lovely system.
sudo make install

c) Creating User

Create an user named icecast.
sudo useradd -s /sbin/nologin icecast

d) Making Directories

Create the following directories:

  • /var/run/icecast
  • /var/run/icecast

sudo mkdir -p /var/run/icecast
sudo mkdir -p /var/log/icecast

e) Transferring Ownership

You should transfer the ownership of the created directories and their subdirectories and contents to the icecast user recursively.
sudo chown -R icecast:icecast /var/run/icecast
sudo chown -R icecast:icecast /var/log/icecast

f) Replacing Log Directory

Inside the /etc/icecast.xml file, replace the path of the log directory from /usr/local/var/log/icecast to /var/log/icecast.
sudo sed -i /etc/icecast.xml -e "s,/usr/local/var/log/icecast,/var/log/icecast,g"

g) Putting systemd Unit File

You have to make a systemd unit file for the Icecast.

sudo echo '[Unit]  

ExecStart=/usr/local/bin/icecast -c /etc/icecast.xml
ExecReload=/usr/bin/kill -HUP $MAINPID

[Install]' > /etc/systemd/system/icecast.service

h) Reloading systemd Manager Configuration

Since you have created a new unit file, you have to make the systemd aware of it by reloading.
sudo systemctl daemon-reload

i) Configuring The Icecast Server

Inside the /etc/icecast.xml file, change the details using your favorite text editor with superuser privileges. Here, we will use port 17101.
And also change admin-user, admin-password, source-password and other settings as per as your wish.

j) Enabling Autostart

To tell systemd to start the icecast service automatically at boot, you have to enable it.
sudo systemctl enable icecast.service

k) Starting

Start the icecast service.
sudo systemctl start icecast.service
The radio station server will start listening on port 17101 (we defined).

l) Making FirewallD to Allow

You may have to add the port to the FirewallD‘s allow list.
sudo firewall-cmd --zone=public --permanent --add-port=17101/tcp
Then reload the FirewallD.
sudo firewall-cmd --reload

Let’s check out an example:


Abdullah As-Sadeed

Abdullah As-Sadeed