SSD Nodes Learn Hosting plans →
Guides Matt ConnorBy Matt Connor

Run an Internet Radio Station with Icecast

Set up Icecast on Ubuntu, connect a live audio source through SSH, serve listeners over HTTPS, and check bandwidth, authentication, and playback.

What you will build

Icecast distributes a continuous audio stream to listeners. An encoder supplies that stream, and each listener receives a separate connection. This guide uses Ubuntu 24.04, Icecast bound to the server's loopback address, and Nginx for public HTTPS playback. Your broadcasting computer connects through an SSH tunnel, keeping source credentials off an unencrypted public connection.

You need a VPS with sudo access, a domain such as radio.example.com pointing to its public address, and a desktop encoder that supports Icecast and MP3 output. Replace that example domain throughout. Have an audio file or microphone ready for the first broadcast, and use material you have permission to broadcast.

An internet radio station plays the same live programme for everyone. If you want listeners to choose individual tracks from a library, self hosted music streaming on a VPS covers that different workflow.

Install Icecast and Nginx

Update the package index and install the server packages:

sudo apt update
sudo apt install icecast2 nginx curl certbot python3-certbot-nginx

If the Icecast installer offers configuration questions, enable the service and choose unique source, relay, and administrator passwords. You will review its configuration before broadcasting. Do not reuse your SSH password for any Icecast account.

Back up the installed configuration before editing it:

sudo cp -a /etc/icecast2/icecast.xml /etc/icecast2/icecast.xml.before-radio
sudoedit /etc/icecast2/icecast.xml

Keep the package's existing paths, logging settings, and security settings. Within the existing configuration, change hostname to your public domain and replace the authentication passwords. These are excerpts to edit in place, not a replacement for the complete file:

<hostname>radio.example.com</hostname>

<authentication>
    <source-password>REPLACE_WITH_SOURCE_PASSWORD</source-password>
    <relay-password>REPLACE_WITH_RELAY_PASSWORD</relay-password>
    <admin-user>admin</admin-user>
    <admin-password>REPLACE_WITH_ADMIN_PASSWORD</admin-password>
</authentication>

Use long, distinct passwords. XML reserves characters such as ampersands and angle brackets, so choose passwords that avoid those characters or escape them correctly. Replace every placeholder before restarting.

Set the existing listening socket to loopback:

<listen-socket>
    <port>8000</port>
    <bind-address>127.0.0.1</bind-address>
</listen-socket>

Inspect the rest of the file for additional listening sockets. Remove or restrict any socket that would expose Icecast directly. This setup needs only the loopback listener; Nginx handles public playback.

Start the service and check its state:

sudo systemctl enable icecast2
sudo systemctl restart icecast2
sudo systemctl status icecast2 --no-pager
sudo ss -ltnp
curl -I http://127.0.0.1:8000/

Confirm that port 8000 listens on 127.0.0.1. If the service fails, read its journal before changing anything else:

sudo journalctl -u icecast2 -n 50 --no-pager

Publish the listening mount through Nginx

Create a dedicated Nginx site:

sudoedit /etc/nginx/sites-available/radio

Add this configuration, substituting your domain:

server {
    listen 80;
    server_name radio.example.com;

    location = /radio.mp3 {
        proxy_pass http://127.0.0.1:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Connection "";
        proxy_buffering off;
        proxy_read_timeout 1h;
    }

    location / {
        return 404;
    }
}

The exact location publishes only /radio.mp3. Icecast's administration interface remains accessible through loopback. Proxy buffering is disabled so Nginx forwards audio as it arrives. The read timeout allows a long interval between upstream reads, although a healthy audio stream should continuously deliver data.

Enable the site, validate the configuration, and reload Nginx:

sudo ln -s /etc/nginx/sites-available/radio /etc/nginx/sites-enabled/radio
sudo nginx -t
sudo systemctl reload nginx

Run the symlink command once. If you are repairing an existing installation, inspect the existing link instead of repeatedly recreating it. For more context on these directives, see how an Nginx reverse proxy forwards requests.

Allow inbound TCP ports 80 and 443 in your provider firewall. If UFW is already active, permit them there too:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Keep SSH permitted. Do not enable a firewall remotely until its SSH rule is correct. UFW firewall basics for a VPS explains that sequence. Port 8000 does not need a public firewall allowance.

Once DNS resolves correctly and port 80 is reachable, request the certificate:

sudo certbot --nginx -d radio.example.com --redirect
sudo certbot renew --dry-run

Follow the prompts and use a working contact email address. If validation fails, resolve DNS and firewall problems before retrying. HTTPS with Certbot and Nginx on Ubuntu covers certificate setup and renewal in more detail.

Connect your broadcasting computer

On your broadcasting computer, open an SSH tunnel to the VPS:

ssh -N -L 127.0.0.1:18000:127.0.0.1:8000 YOUR_SSH_USER@YOUR_SERVER_IP

Replace both placeholders with your normal SSH login details. Keep this terminal open during the broadcast. Local port 18000 forwards to Icecast on the VPS, with SSH encrypting traffic between the computers.

Configure your encoder with these settings:

  • Server type: Icecast.
  • Server address: 127.0.0.1.
  • Server port: 18000.
  • Username: source.
  • Password: the source password from icecast.xml.
  • Mount: /radio.mp3.
  • Encoding: MP3 at 128 kbps for the initial test.

Select your audio input and start broadcasting. The mount name does not select the codec: the encoder must actually produce MP3 audio. A filename ending in .mp3 cannot convert another format.

The SSH tunnel is part of this live source connection. Closing it disconnects the encoder, even though Icecast and Nginx keep running. If your encoder supports reconnecting automatically, enable that option and test it before a scheduled show.

Verify playback and capacity

Open https://radio.example.com/radio.mp3 in a compatible player on another device. Test from a different network when possible; that checks public DNS, the firewall, TLS, and the proxy together. You should hear the current programme after the player's initial buffer fills.

You can also inspect the response while the source is connected:

curl --max-time 5 -D - -o /dev/null https://radio.example.com/radio.mp3

Expect a successful HTTP response and incoming bytes. Because a broadcast has no natural end, curl reaching the five second timeout is expected. A 404 before an encoder connects is also expected because the mount does not yet exist.

Budget bandwidth from simultaneous listeners, not just the encoder's upload. At 128 kbps, 100 listeners require approximately 12.8 Mbps of audio payload leaving the VPS. One listener connected continuously for 30 days consumes about 41.5 GB in decimal units before protocol overhead. Multiply by average concurrent listeners and allow additional capacity for overhead and peaks.

Check your plan's transfer allowance and observe actual usage during a small trial broadcast. Review the existing clients limit in Icecast before advertising widely. Raising that number does not increase the server's network capacity.

Liquidsoap automation and the security update

A desktop encoder is enough for a live show. Liquidsoap is useful when you need server side playlists or scheduled audio without keeping your broadcasting computer connected. It supplies audio to Icecast; it does not replace Icecast's listener distribution role.

I opened the upstream release page today and confirmed that Liquidsoap 2.4.7 is marked Latest, dated 5 December 2026, and described as a security release requiring an update.

As of 6 December 2026, the current stable Liquidsoap release is 2.4.7. Do not describe 2.4.6 as the current release. Check the version actually installed before adapting an automation script, and use documentation matching that version. An Ubuntu package version and the latest upstream release are separate facts.

For an existing Liquidsoap station, update through its installation method and verify playback afterward. Keep a copy of the working script and configuration before making that change. This live encoder setup does not require installing Liquidsoap.

Troubleshoot an interrupted broadcast

If the encoder reports authentication failure, compare its source password with the server configuration and confirm that its username is source. The administrator password serves a different purpose. Restart Icecast after configuration edits, then reconnect the encoder.

For a public 502 response, first check whether Icecast is running and reachable on loopback. For a public 404, confirm that the source is connected and its mount exactly matches /radio.mp3, including case. If playback connects but remains silent, check the encoder's input meters and local monitoring before changing Nginx.

Keep configuration backups private because they contain credentials. Test both an encoder restart and a server restart before relying on the station for a scheduled event.

FAQ

Does Icecast play my music files itself?

No. A source encoder reads files or captures live audio and sends an encoded stream to Icecast. Icecast distributes that stream to listeners.

Why is port 8000 closed to the public?

This configuration routes listeners through HTTPS on Nginx and routes the broadcaster through SSH. Icecast therefore needs only its loopback listener, while its administration endpoints remain outside the public proxy route.

Can I broadcast without Liquidsoap?

Yes. The desktop encoder workflow above works independently of Liquidsoap. Add automation when you need unattended playlists or scheduling.

Why does the stream stop when I close SSH?

The encoder reaches Icecast through the SSH tunnel. Closing that connection removes its route to the server. Keep the tunnel running during live broadcasts and reconnect the source after restoring it.

Was this article useful?

#icecast#liquidsoap#streaming#internet-radio#ubuntu#self-hosting