Back to articles
DevOps & Systems

Comprehensive Guide to Building a Professional Online Radio Station with Icecast on Ubuntu VPS

Detailed guide to installing, configuring, and operating a professional online radio station using Icecast on Ubuntu VPS, including audio setup, security, monitoring, and Nginx...

DPTCloud Engineering4 min read
Comprehensive Guide to Building a Professional Online Radio Station with Icecast on Ubuntu VPS

Introduction

In the digital era, online radio has become a popular and effective communication channel. With an Icecast server on an Ubuntu VPS, you can build a professional, stable, and scalable online radio station. This guide walks you through installing, configuring, and operating a live streaming radio platform using Icecast, a powerful open-source solution for internet radio.

Prerequisites

  • An Ubuntu VPS (Ubuntu 20.04 or 22.04 minimum)
  • FFmpeg for audio processing
  • Icecast for live streaming
  • A domain name (recommended)
  • SSH access to the VPS

Install and Configure Icecast

Start by updating the system:

sudo apt update && sudo apt upgrade -y

Install Icecast:

sudo apt install icecast2 -y

Configure the Icecast configuration file:

sudo nano /etc/icecast2/icecast.xml

Modify the following sections:

<icecast>
    <location>My Radio Station</location>
    <admin>[email protected]</admin>
    <hostname>your-vps-ip</hostname>
    <port>8000</port>
    <max-clients>100</max-clients>
    <password>your_password</password>
    <source-password>source_password</source-password>
</icecast>

Restart the Icecast service:

sudo systemctl restart icecast2

Integrate Nginx as a Reverse Proxy

To enhance security and performance, use Nginx as a reverse proxy for Icecast:

sudo apt install nginx -y

Create an Nginx configuration file:

sudo nano /etc/nginx/sites-available/icecast

Add the following content:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:8000;
        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-Proto $scheme;
    }
}

Enable the configuration:

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

Monitoring and Security

To ensure stable operation of your radio station, implement monitoring and security measures:

  • Set up logs for Icecast and Nginx to track activity
  • Run Icecast on port 8000 and do not expose it directly to the internet
  • Use UFW firewall to restrict access:
sudo ufw allow 80,443,8000/tcp
sudo ufw enable

Ensure user accounts are managed and updated regularly.

Authentication and Testing

After configuration, test your radio station:

  • Open a browser and navigate to http://your-domain.com:8000
  • Verify you see the Icecast admin page
  • Stream audio from your machine using FFmpeg:
ffmpeg -re -i /path/to/audio.mp3 -c:a libmp3lame -b:a 128k -f mp3 icecast://[email protected]:8000/stream

If the audio plays successfully, your station is operational.

Troubleshooting

  • If access fails, verify firewall and Nginx configurations
  • Ensure Icecast is running: sudo systemctl status icecast2
  • Check logs: sudo journalctl -u icecast2
  • Confirm FFmpeg is installed and has access to the audio file

References

DPTCloud Tier III Infrastructure

Recommended NVMe Cloud VPS Plans to Deploy This Setup

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02

VPS-2E

94.600 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 2 GB
  • SSD: 30 GB NVMe
ECO · vn-02Recommended

VPS-3E

170.500 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 4 GB
  • SSD: 50 GB NVMe
BASIC · vn-01Recommended

VPS-05

457.600 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478