Icecast is an open source streaming media server, used by radio stations around the world. Many people lease a streaming server from a dedicated streaming provider, but you can also host your own Icecast Streaming Media Server on a VPS for only US$3.50 per month! It’s super easy – this article shows you how!
Not only is this a good way to save some money on hosting, but it’s also a great project to get to know Linux. For this project, we’ll be using Ubuntu Linux on a cloud provider. I’ll show you some basic commands for installing Icecast, editing configuration files and restarting services.
At 1949 words, this article is quite long. But don’t fear – we have plenty of screenshots, and the guide is very easy to follow. If you’ve never touched Linux before, you should be able to easily complete this in under an hour.
- Selecting a VPS Web Host
- Creating a VPS
- Setup and Configure Icecast
- Configure Your Streaming Audio Encoder
- Followup Configuration
Part 1: Selecting a VPS Web Host
The first step is to find a web host capable of hosting Icecast. Thankfully, there’s countless web hosts out there perfectly capable of hosting a simple Icecast server. What we’re looking for is someone who can provide us with a ‘VPS’ (Virtual Private Server), or VM (Virtual Machine).
You could go with AWS, Azure, Google Cloud, OVH, Linode… literally any of the thousands of VPS providers out there. My personal preference is Digital Ocean and Vultr. Why? These two companies provide reliable services in a variety of locations, with a generous quantity of included bandwidth. They also have excellent support, and easy to use control panels.
Many of the ‘top tier’ providers (AWS, Azure, and Google Cloud) charge through the roof for bandwidth, making this an increasingly cost prohibitive exercise if your stream becomes popular.
At the time of writing, here are some of the appropriate Icecast hosting plans from Digital Ocean and Vultr:
|Monthly Bandwidth Allowance
|Price Per Month
After you reach US$20/month with each of these providers, the bandwidth does not scale at the same rate. If you need additional bandwidth, it’s better to create a Round-Robin DNS setup with multiple Icecast servers than simply increasing the specs on one single server.
Icecast scales very well, even with modest system specifications. You can take a look at some historic load testing data, and see that they achieved 14,000 simultaneous listeners on a Dell Poweredge 1850 (2005 era hardware) with a single Xeon processor. In this test, it did not exceed 25% CPU usage. Assuming a 64Kbps stream, this number of listeners would almost saturate a 1Gbps link. While I wouldn’t recommend attempting this number of simultaneous listeners on one of these VPS servers listed above, you can comfortably achieve hundreds of simultaneous listeners on one of these servers – the available bandwidth being the main limiting factor. Icecast is very efficient because it does not transcode your audio – it simply relays an incoming audio stream to multiple listeners.
To work out how much bandwidth you need, determine the bandwidth of your stream (e.g. 64Kbps) and the maximum number of concurrent listeners you expect to have at any one time. You can then enter this into Google to get an approximation of your monthly bandwidth needs:
Once you’ve picked your web host, go sign up with your chosen provider. Here’s those links again: Digital Ocean and Vultr. Both of these providers allow you to cancel your server any any time, and you only pay for the time you use – so it’s very easy to give it a shot.
The web host links in this article are affiliate links. I will receive some account credit with them if you sign up and spend over a certain amount – it doesn’t cost you anything, and it helps me continue to run this website. I use both these companies myself and have no problem recommending them, regardless of an any affiliate program.
Part 2: Creating a VPS
Once you’ve selected your provider and signed up for an account with then, it’s time to create a server. For this part of the guide, I’m going to use Vultr’s control panel. Other providers should look similar.
In the ‘Server’ section of the control panel, click the big blue plus icon in the top right.
Next, we need to configure our new server and create it.
- Select the location for your VPS. Icecast isn’t very latency sensitive, but it’s still best practice to locate your server closest to your listeners. Thankfully for me, Vultr have a Sydney datacentre (Digital Ocean do not).
- Select the latest version of Ubuntu, which at the time of writing is ‘Ubuntu 18.04 x64’
- Select your plan – because I’m not expecting many listeners, I selected the US$3.50/month plan.
- You may wish to enable auto backups and IPv6. Private Network isn’t necessary for this setup, and DDoS Protection sadly isn’t available in Sydney.
- Ignore the ‘Startup Script’, ‘SSH Keys’ and ‘Firewall Group’ sections
- Enter the DNS hostname you wish to use for your server. This doesn’t create a DNS entry, but does configure Reverse DNS. You’ll need to configure DNS with your existing DNS provider.
Once you’re happy with your selection, press ‘Deploy Now’!
Your VPS will now be created. While your VPS is still being setup, you’ll see this in the Vultr console:
Once setup has finished, you’ll get an email with important details such as the IP address.
Part 3: Setup and Configure Icecast
Now that we have a server, it’s time to jump in and configure it for Icecast. In the Vultr console, click on the three little dots next to the server, then click ‘View Console’.
This opens up a nice little popup window, which is the command-line console for your new server.
Back in the main window, click on ‘Server Details’ and find the ‘Root Password’ on that screen.
Back in the command line (console), type in the username ‘root’, and press enter. Then type in the password you found on the Server Details screen, and press enter. You will not be able to see the password as you type it in.
We’re in! If you’ve never used a command line before, don’t worry! I’m going to guide you through everything you need to know.
A couple of general pointers for working on a Linux command line:
- You can see every command as you type, except passwords are generally hidden
- Press enter to execute a command
- Press Control + C (or sometimes Control + X) to quit a program, or cancel typing a command
There’s a few quick preliminary steps we’re going to want to take to get everything configured and happy.
Change the root password
Enter your existing password (from the Vultr Server Details screen), and your new password twice. Press ‘Enter’ after each time you enter a password.
apt-get update && apt-get upgrade
This command will all software on your server that needs to be upgraded. It will ask you to confirm the upgrade, so type the letter ‘Y’ and press enter.
You may need to reboot afterwards. In this case, type this command and press enter:
Set the timezone
Use your arrow keys to select your region and city. Press enter to make a selection.
apt-get install icecast2
Again, this It will ask you to confirm the installation, so enter the letter ‘Y’ and press enter.
Part way through the installation process, you’ll be prompted to step through an installation wizard.
For some reason, it came up a bit garbled on my computer screen, but it still works just the same.
Using the wizard is simple – use the arrow keys to select between Yes/No, Enter to go to the next screen, and your keyboard to fill out the answers.
This process will ask for your server name (DNS address you entered in the Vultr console), and for some new passwords. Take note of these passwords, as you’ll need them later.
Further Icecast Configuration
All this configuration is stored in an XML file. To open up an editor, type the following and press enter:
This opens up a simple text editor called ‘Nano’. Use your arrow keys to navigate around the document, and Ctrl + X to exit (if you make changes, it asks you if you wish to save – type ‘Y’ and press enter again).
Full Icecast.xml documentation is available on the Icecast website.
For now, we’re only going to change two settings – the port number, and the user that Icecast runs under.
Using your arrow keys, scroll until you see the line ‘<port>8000</port>’. Change the number ‘8000’ to ’80’. This puts Icecast on the default HTTP port, making it easier for people to listen behind a corporate firewall.
Next, scroll right to the bottom of the file where you can see a security section. Delete the text ‘<!–‘ and ‘–>’ (leaving everything in the middle. It should now look like this:
To exit and save, press Ctrl + X, Y and Enter.
We also need to change one more file to make this work. Type in:
Change the USERID and GROUPID values to ‘root’. It should look like this:
To exit and save, press Ctrl + X, Y and Enter.
Finally, we probably need to change the log file ownership with this command:
chown -R nobody /var/log/icecast2/
Whenever you change Icecast.xml, you need to restart the service with the following command:
service icecast2 restart
Alternatively, you can just reboot the server:
Now, Icecast should be installed and active! In a web browser on your desktop computer, go to the IP address of your Icecast Server (again, found in the Vultr Server Details Screen). It should look a bit like this:
If you have trouble getting Icecast to start, try the following options.
View the Error Log with this command:
Verify the configuration with this command:
icecast2 -c /etc/icecast2/icecast.xml
Part 4: Configure your Streaming Audio Encoder
Icecast now works! Now we need to send some live audio to it.
There is a whole variety of Icecast-compatible stream encoders, but for this example we’re going to use Butt (Broadcast Using This Tool), as it supports both PC and Mac. You could also use Edcast, Altcast, or a whole variety of commercial encoders – your automation system may even come bundled with an encoder.
First, download and install Butt on your PC. or Mac I’ll wait.
Now, open Butt and click the ‘Settings’ button. Then, under the ‘Server’ heading click ‘Add’. Now, enter your configuration details as follows:
- Name: Any arbitrary name
- Type: Icecast
- Address: The IP Address of your Icecast server
- Port: 80
- Password: The ‘source’ password you configured during setup
- Icecast Mountpoint: The URL name for your stream (all lowercase, no spaces or special characters)
- Icecast User: source
You can also change the audio codec, bitrate, etc.
Now, click “Add” and “Save”.
To connect your computer’s audio input to Icecast, press the “Play” button in the main window. If successful, it will show you the connection settings.
If you go back to your web browser with the Icecast screen, you’ll see the details about the new stream:
Congratulations! You’ve now setup an Icecast Server and connected an Encoder to it.
Part 5: Followup Configuration
There is much more you can do with Icecast. Check out the full documentation. For example, you can relay streams from other servers or setup a mount with a specific password (useful if you’re sharing your server with someone else).
Here are some other articles I’ve written about Icecast: