Install Icecast on Ubuntu 20.04

Updated on June 9, 2022
Install Icecast on Ubuntu 20.04 header image

Icecast is a free audio media streaming solution that lets you create an audio streaming platform with support for MP3 and Ogg Vorbis audio streams. This guide explains how you can install Icecast on a Ubuntu 20.04 server.


1. Installation

  1. Update the server.

      $ sudo apt update
  2. Upgrade server packages.

      $ sudo apt upgrade
  3. Install Icecast

      $ sudo apt install icecast2

    Several prompts show up, select yes to configure passwords, keep localhost as the server hostname, then set the Icecast source, relay, and administrator passwords.

  4. Enable Icecast to start at boot time.

      $ sudo systemctl enable icecast2
  5. Start the Icecast server.

      $ sudo systemctl start icecast2

2. Configuration

  1. Edit the main Icecast configuration file.

      $ sudo nano /etc/icecast2/icecast.xml
  2. Find the following line.

        <!-- <bind-address></bind-address> -->
        <!-- <shoutcast-mount>/stream</shoutcast-mount> -->

    Change the Icecast port to your preferred setting, 8000 by default.

  3. To change the administrator and source passwords, find the following section.

        <!-- Sources log in with username 'source' -->
        <!-- Relays log in with username 'relay' -->
        <!-- Admin logs in with the username given below -->

    Save the file.

  4. Restart Icecast to load changes.

      $ sudo systemctl restart icecast2

3. Configure Nginx as a Reverse Proxy

  1. Using a text editor, create a new Nginx configuration file.

      $ sudo nano /etc/nginx/conf.d/icecast.conf
  2. Add the following contents to the file. Replace with your real domain.

      server {
       listen 80;
       listen [::]:80;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
      location / {
       proxy_set_header Accept-Encoding "";
       sub_filter_types application/xspf+xml audio/x-mpegurl audio/x-vclt text/css text/html text/xml;
       sub_filter ':8000/' '/';
       sub_filter '@localhost' '';
       sub_filter 'localhost' $host;
       sub_filter 'Mount Point ' $host;

    Save the file.

  3. Check the Nginx configuration for errors.

      $ sudo nginx -t
  4. Restart Nginx.

      $ sudo systemctl restart nginx

4. Security

  1. Allow Full Nginx access through the firewall.

      $ sudo ufw allow 'nginx full'
  2. Allow the Icecast port to enable broadcast requests to the server.

      $ sudo ufw allow 8000/tcp
  3. Restart the firewall to load changes.

      $ sudo ufw reload

5. SSL

  1. Install the Certbot Nginx package.

      $ sudo apt install certbot python3-certbot-nginx
  2. Request a new SSL certificate.

      $ sudo certbot -d --agree-tos
  3. Restart Nginx to load changes.

      $ sudo systemctl restart nginx

6. Test

  1. Visit your domain to confirm that Icecast is up and running.
  2. Download and Install Mixx on your computer.

  3. Open Mixx, and navigate to Preferences.

  4. Select Live Broadcasting, and enter your domain in the Host field, enter source in the Login field, specify a Mount point, for example /stream, enter the Icecast port, blank, then, the source Password specified in the Icecast configuration file.

  5. Start your Mix, and toggle ON AIR to go live.

  6. Using a different device, load your mount point on the domain.

Your Mixx stream should start playing.

More Information

You have installed Icecast on Ubuntu 20.04, for more information and configuration options, visit the following guides.