Install Icecast on Ubuntu 18.04

Updated on November 21, 2023
Install Icecast on Ubuntu 18.04 header image

Introduction

Icecast is a popular and flexible solution for streaming audio used primarily for Internet radio stations. It supports Ogg, MP3, Opus and WebM streaming formats over HTTP, SHOUTcast, AAC and NSV. It has been in active development for 20 years and it is popular for its reliability, simplicity and adherence to open standards. It is released as free software under the GNU GPLv2 license.

Installation

Update the APT package list:

sudo apt-get update

Install Icecast:

sudo apt-get install icecast2

Configure Icecast

Right after installing the package an automated configuration window will open. Select Yes to configure Icecast, and follow the prompts.

Icecast can be further configured editing the XML configuration file /etc/icecast2/icecast.xml. The following is an example of how to change the port.

The port can be modified by editing the <port> tag. It is set to 8000 by default:

<port>DESIRED_PORT_NUMBER</port>

Save and exit the file.

Note: To apply the configuration changes you need to restart Icecast.

Further documentation about Icecast config files can be found here.

Binding privileged ports

If you want to run Icecast Server over privileged ports like HTTP (80) and HTTPS (443) you need to do some extra configuration.

Open the config file:

sudo vi /etc/icecast2/icecast.xml

Find the <security> section. Uncomment the <changeowner> section inside and make the following changes:

<security>
    <chroot>0</chroot>
    <changeowner>
        <user>icecast2</user>
        <group>icecast</group>
    </changeowner>
</security>

We also need to tell the operating system to launch Icecast as root.

Open the service file:

sudo vi /etc/default/icecast2

Modify the USERID and GROUPID options so they match the following:

USERID=root
GROUPID=root

Start, restart and stop Icecast

To start the Icecast Server:

sudo systemctl start icecast2

To restart and reload configuration changes:

sudo systemctl restart icecast2

To stop Icecast:

sudo systemctl stop icecast2

Admin panel

Icecast comes with a web interface that serves the audio streams as files. It includes an admin section which lets you see basic information and statistics. You can access it by navigating your web browser to your server address or domain and the port, http://ADDRESS:PORT or http://example.com:PORT.

Streaming with a Source Client

Once the Icecast Server is setup you can use any of the compatible Icecast Clients, (also known as Source Clients), to transmit audio to the Icecast Server and to all the listeners. Usually the Source Client is installed remotely in the location where the audio is going to be transmitted but can be installed together with the Server if needed. There are a variety of options from free and open source applications like mixxx for DJs, IceS for complex automated setups and BUTT for simple microphone sharing; as well as many closed source solutions. A list of free and open source Source Clients can be found at Icecast's app list

Conclusion

The scope of what Icecast is capable of doing is far beyond this basic setup. Visit the Icecast documentation to explore all the features that it offers, such as: stream relaying, advanced authentication, transcoding, public radio listings and more.