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.
wget http://downloads.xiph.org/releases/icecast/icecast-2.4.4.tar.gz
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 !
make
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]  
Description=Icecast  
After=network.target  

[Service]  
Type=simple
Restart=always
RestartSec=5
User=icecast
ExecStart=/usr/local/bin/icecast -c /etc/icecast.xml
ExecReload=/usr/bin/kill -HUP $MAINPID

[Install]  
WantedBy=multi-user.target' > /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.
<port>17101</port>
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: https://bitscoper.live:17101/


Documentation

Abdullah As-Sadeed

Abdullah As-Sadeed