How to setup an Icecast streaming server


A guide by Andy Moore First published January 2020, revised August 2020

This Icecast tutorial covers everything you need to know and do

This guide has been used by Internet Radio newcomers as well as seasoned broadcast professionals from AM, FM and DAB stations worldwide.

It comes complete with all you need to know and is equipped with a Bandwidth Calculator and Mountpoint Configuration Tool to help make it easier!

I first streamed a radio station online back in 1999 when I was working at 107 Oak FM as a presenter and Traffic Manager
I ran a cable from the racks room with studio output into my PC where the signal was converted and sent through the web via dialup

Things have come a long way since 1999; the days of plugging patch cables into Soundblaster sound cards, and dialup internet on a phone line with a 56k modem are long gone, but some internet radio streaming providers are so over subscribed you might as well be back in the last century.

Does your internet radio streaming provider:

If you answered yes to the above, isn't it time you started running your own streaming server?

This guide to setting up; managing and broadcasting with Icecast is broken down into several sections:


Preamble / What you need:


Icecast and Shoutcast hosts are common, most of them these days rely on stream management software like Centovacast; most of them are in the hosting business, as a general rule they know about hosting, but they don't know about radio.

You know about radio, by you being here I assume you want to learn about how to make Icecast yours, and to stop paying a streaming company!

1) A Cloud Server

DigitalOcean, Inc. is an American cloud infrastructure provider headquartered in New York with data centers worldwide. DigitalOcean provides developers cloud services that help to deploy and scale applications that run on multiple computers.

2) An Icecast Server

Icecast is a streaming media (audio/video) server which currently supports Ogg (Vorbis and Theora), Opus, WebM and MP3 streams. It can be used to create an Internet radio station or a privately running jukebox and many things in between. "

Affiliation Disclaimer: If you sign up to Digital Ocean via the links on this page you'll get $100 free credit to test with: if you stay with them I get a small bounty.


Part A: Creating a Cloud Server


I've hosted my websites and streams with Digital Ocean for years, they're a rock solid dependable provider whom I trust enough to recommend.

Navigate to https://cloud.digitalocean.com/droplets/

At the top of the screen there's a green button that says "Create", click that, then click "Droplets" from the list.

Step One: Choose an image



This is the flavour of the server you're going to use, select "Ubuntu".

Step Two: Choose a plan

1,000 GB is enough data for more than 10,000 people tuning in and listening for an hour at 192 kbps

The smallest and cheapest server comes with:


Bandwidth Calculator:


How much data do you need?

This bandwidth calculator is limited, for more options like higher bitrates, and more listeners, please see my more advanced bandwidth calculator.

Step Three: Choose a Choose a datacenter region



Pick the DigitalOcean datacenter which is closest to your listeners.

Step Four: Authentication

Before you continue you're going to need two small, free, yet powerful bits of software that will help you secure your server, and then later be able to talk to it so you can install Icecast.

Download and install PuTTYgen

PuTTYgen is a key generator tool for creating pairs of public and private SSH keys.

Download and install PuTTY

PuTTY is an open source SSH and telenet client that is available with source code and is developed and supported by a group of volunteers.

Fire up PuTTygen.



Click "Generate", then to create some mathematical randomness you need to move your mouse around in a random manner.



When the key has been generated you should also add a passphrase. Make sure you can remember this, but make sure it's not easy to guess.

Click "Save public key", then click "Save private key", remember where you saved these keys, you'll need to know that in further steps.

Backup your Public and Private keys - then back them up again somewhere else for safety

Now highlight all the of goofy looking text from the top of PuTTYgen and copy this to your clipboard.

Your public key will look something like this:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAg4bvY4sWd8QfQZGjteRcHihj1jdA1yt62Q0roLf6eRQ+RIIPpu8y7dnRMnVfbQSlOkpKkMssJNY5FLVpprvZaIk4sbc40t1TZ7ZTDuSseH6Cez6LAEj1tDdA0Z3rFaQeAZtNYbJaXvIl6dP9PABvdR7fRDxViVQFsnXukJJP/lDFBjZOsjpD+HACxLpnQIghnwc3gYJW4w+cOnWzPwKjHaS1qm6h4ONX4Mjw8DIZTRBl8MNxwDK+tzlEgtiL+L4LD6PzSEWh8xAu0fMOWrE+ywLF9GLzZ6+durP3xx6iA/hT7Gxtcpud7YYQjgbQg2Hj7aBMfc1UH6T4YtJ/4v0/NQ== rsa-key-20200225

Return to the DigitalOcean site where you have a choice as to how you authenticate with your new server:



Droplets that use SSH keys have password authentication disabled by default.
This makes them secure against brute-force attacks.

As you may have guessed, you're going for the stronger of the options. Select "SSH keys"

Click "New SSH Key", this will launch the screen below:



Paste your public key into the form, give the key a name and click the "Add SSH Key" button.


Step Five: Finalize and create



You only need one droplet but you should give it a friendly name like "Icecast-Streaming-Server".

BACKUP, BACKUP, BACKUP

Add backups. Just do it. On a $5.00 droplet it only costs $1.00 a month which is the smallest price to pay for the peace of mind it brings.

Don't just enable backups, know how to restore them too!

I was working at Minster FM as Group Traffic Manager many years ago when there was a power cut which knocked us off air; a few of us dragged the backup generator out of storage, and hurt our backs getting the damn thing operational.

Backups are a waste of space if they're not regularly tested or you don't know how to use them, a backup generator which can't start because it's not been run in five years is as much use as a chocolate fireguard, or a sperm based contraceptive: we were off air that day for several ad breaks, it cost money, it was a pain in the a*s, but it hammered home the importance of backups, and being able to restore them.



Now it gets exciting, press the big green "Create Droplet" button:



This will probably take about a minute to create your server, once it's done it'll be assigned an IP address.

Copy your new IP address. Write it down too.

Step Six: Logging into your new cloud server

Launch PuTTY and paste your IP address into the "Host Name [or IP address]" field.



On the left hand side menu on PuTTY double click the "SSH" option, then click "Auth" followed by clicking "Browse" next to the "Private Key File for Authentication" option.



Select your Private Key's .ppk file from where you saved it, then click "Session" from the menu at the very top.

Where it says "Saved Sessions" enter a name like "Icecast Server" and click "Save", now PuTTY will remember the details, and that makes it really easy to login to your server in the future.

Now, click the "Open" button in the bottom right corner of PuTTY to connect to your server.

You'll be greeted by a one-time "Security Alert", you know the server is sound, you just made it so go ahead and click "Yes" to proceed.



Where it says "Login as" you should enter "root" without the quotes, and all lower case; then hit enter, you will be prompted to enter the security passphrase you setup when you created your public and private keys, enter your secret passphrase and hit enter.



You are now logged in!


Part B: Installing Icecast


According to the official Icecast installation guide it only takes four commands to install the latest version.

Step One: Add the repository

On your new Ubuntu server you'll be installing Icecast from what's called the repository, it's like an app store for servers and you just need to tell the server where to get the latest Icecast software from.

Copy the following command to your clipboard, then paste it into PuTTy:

sh -c "echo deb http://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_18.04/ ./ >>/etc/apt/sources.list.d/icecast.list"

To paste in PuTTY you need to right-click your mouse

PuTTy is peculiar software if you're new to it, it's not like your regular computer.

When you use PuTTy you're using one computer to talk to another: CTRL+V will not work, to paste you need to click the right mouse button.

Step Two: Import the Multimedia signing key

The official installation guide says: "You need to add the openSUSE OBS Multimedia signing key as a Trusted Key to your system." to do this copy, then right-click to paste the following into PuTTy:

wget -qO - http://icecast.org/multimedia-obs.key | apt-key add -

Step Three: Update your repository index

This is akin to updating the app store on your phone:

apt-get update

Step Four: Install Icecast

Now you're starting to get down to it!

apt-get install icecast2



The server will ask for your go ahead to install Icecast, type "Y" (without the quotes) and press enter.

It will then ask you if you want to configure:



Select "Yes", you can do this by hitting your left arrow key, then hitting enter.

It will now ask you to enter a fully qualified domain name, you're running Icecast on an IP address so delete where it says "localhost", then enter the IP address of your new server.



Press your down arrow key once, this should highlight "Ok" in red, hit enter.

Now you'll need to set a source password, the default is "hackme" for those who like to be hacked! You can change your Icecast passwords at any time.



Again, you can hit the down arrow key to highlight "Ok" in red, then hit enter.

It will repeat the process for the "Relay Password" too, set it, but don't worry about it for now as you're not going to be using Icecast as a relay here.

You'll next be asked to set an "Admin Password", enter something folks can't guess, write it down for safety, then hit enter. At this point your screen will spit out line upon line of text whilst it does what it needs to.

You've installed Icecast: congratulations!

Go back to your web browser and navigate to http://your_ip_address:8000 you should see confirmation that Icecast is installed.



Part C: Configuring Icecast


Now that Icecast is installed you need to configure it. To do this you need to edit a file, in PuTTy run the following command which will bring up a text editor called Nano:

nano /etc/icecast2/icecast.xml

Nano is different to text editors you'll get on your normal computer, I'll tell you what you need to press to get it working for you, but if you want to know more about it here's a beginner's guide to Nano.



If this is your first time working with XML, don't worry, it's colour coded in PuTTy and I'll explain it so it's not as intimidating, then I'll tell you what you need to edit and why.

All you're looking to do here is change some of the white values: don't worry about the rest of it.

If you want to learn more about how to configure Icecast see the documentation for the config file.

Set the location:

Change the Earth value inside the <location> tag to your city, or the location of your server's datacenter.

"This sets the location string for this Icecast instance. It will be shown e.g in the web interface."

Change the admin email address:

Change the icemaster@localhost value inside the <admin> tag to your email address.

"This should contain contact details for getting in touch with the server administrator. Usually this will be an email address, but as this can be an arbitrary string it could also be a phone number. This will be shown e.g. in the web interface."

How many clients (listeners) should it support?

Under the <limits> section the value inside the <clients> tag sets how many listeners you can have at once.

"Total number of concurrent clients supported by the server. Listeners are considered clients, but so are accesses to any static content (i.e. fileserved content) and also any requests to gather stats. These are max concurrent connections for the entire server (not per mountpoint)."

You can push this higher than 100, Icecast can literally handle thousands of listeners: see load test results.

If you want to scale to hundreds of thousands of concurrent listeners Icecast isn't the tool to deliver the audio; it's an essential link in the chain, but to deploy to a huge audience you need to adopt HLS, HTTP Live Streaming which I cover in my guide to creating radio automation in the cloud.

Double check you're happy with your usernames and passwords

Inside the <authentication> section make sure you are happy with the passwords that you set earlier.

Source Password:

"The unencrypted password used by sources to connect to Icecast. The default username for all source connections is 'source' but this option allows you to specify a default password. This and the username can be changed in the individual mount sections."

Admin Username and Password:

"The username / password used for all administration functions. This includes retrieving statistics, accessing the web-based administration screens, etc. A list of these functions can be found in the Administration section of the manual."

Configure your Mountpoint:

Use the down key down in PuTTY to work through the configuration till you see <fileserve> 1 </fileserve>.

Just above that line is where you're going to paste your mountpoint's configuration. To get the code enter the details for your desired mountpoint in the form below, then click the "Generate Mountpoint Config" button.

Mountpoint Configuration Tool:

I do not store any of this information, it's processed in your browser not server side so your secrets are safe

The XML for your Mountpoint:

<mount type="normal">
   <mount-name>CHANGE ME</mount-name>
   <username>CHANGE ME</username>
   <password>CHANGE ME</password>
   <stream-name>CHANGE ME</stream-name>
   <stream-description>CHANGE ME</stream-description>
   <stream-url>CHANGE ME</stream-url>
   <genre>CHANGE ME</genre>
   <bitrate>CHANGE ME</bitrate>
</mount>

Right-click to paste that XML into PuTTY just above the line that says "<fileserve>1</fileserve>".

Further details on all the available mountpoint specific settings can be found in documentation for mountpoints.

Mount Name:

The name of the mountpoint for which these settings apply.

Username:

"An optional value which will set the username that a source must use to connect using this mountpoint. Do not set this value unless you are sure that the source clients connecting to the mountpoint can be configured to send a username other than source. If this value is not present the default username is source."

Password:

"An optional value which will set the password that a source must use to connect using this mountpoint."

Stream Name:

"Setting this will add the specified name to the stats for this mountpoint even if the source client / relay provides one."

Stream Description:

"Setting this will add the specified description to the stats for this mountpoint even if the source client / relay provide one."

Stream URL:

"Setting this will add the specified URL to the stats for this mountpoint even if the source client / relay provide one. The URL is generally for directing people to a website."

Genre:

"Setting this will add the specified genre to the stats for this mountpoint even if the source client / relay provide one."

Bitrate:

"Setting this will add the specified bitrate to the stats for this mountpoint even if the source client / relay provides one. This is stated in kbps."

Saving the new configuration

Once you have added the mountpoint values you will need to save the Icecast XML config file, to do this press "CTRL+X" on PuTTy, it will then ask you to confirm: type "Y" (without the quotes) then hit enter.



It will ask you if you want to change the name of the file, just press enter and you've saved your settings.

Reloading Icecast to activate the configuration

Now you need to tell Icecast to load all the settings from the config file:

service icecast2 reload

You can use the reload command any time you've edited the icecast.xml file.

Now use your browser to navigate to http://your_ip_address:8000/admin/ and log in with the username admin, and the password you configured.



Learn more about the Icecast Admin Interface.


Part D: Streaming audio from your studio to Icecast


In these final steps you need to get audio from your studio computer into the Icecast server, this can be done with a tool like butt (Broadcast Using This Tool) which is free software, or inside your playout system: either way the information you need is pretty much the same.

Address:
Your IP Address
Type:
Icecast
Port:
8000
Mountpoint:
/mountpoint
Username:
Username
Password:
Password

Download butt (Broadcast Using This Tool)

butt (Broadcast Using This Tool) is an easy to use, multi OS streaming tool. It supports ShoutCast and IceCast and runs on Linux, MacOS and Windows. The main purpose of butt is to stream live audio data from your computer's Mic or Line input to an Shoutcast or Icecast server.

Configuring butt to encode your output and send it your Icecast server



Launch butt, then click the "Settings" button, next click the "Server" tab, then click "Add" in the side panel.

Name your stream, select "Icecast" as the "Type", enter your stream's credentials from above, then click "Add".

Under the "Audio" tab on butt, select an "Audio Device" so you actually have some audio to stream!



Go back to the "Main" tab and click the "Save" button, then click the small play icon to start encoding.



butt should now start to encode the audio from your computer, and send it to your Icecast server.



If you need any help with butt take a look at the manual.

You are now streaming live: congratulations!

Checking Icecast and listening for the first time!

Now to check Icecast is picking up the encoded signal from butt.

Navigate back to http://your_ip_address:8000



Using a different computer; a tablet or a mobile phone, navigate to http://your_ip_address:8000/listen

If you do this on the same machine that you'll be sending your soundcard's output from, you will create infinite loops of auditory madness, it's best to use another device.



Now if you return to your Icecast admin page you'll see you've got a listener.



All working? Now is a good time to back everything up!

You've invested some time in this, let's make sure that work is safe. It'd be a good idea to backup your Public and Private keys, plus your Icecast administrator and broadcaster details.

If you'd like to replicate this server in the future you might want to learn how to take a snapshot.


Part E: Managing Icecast


Start / Stop / Restart / Reload

Anytime you need to manage your server you just fire up PuTTy, select "Streaming Server" and click "Open", it'll ask you for your username, in this case it's "root" (without the quotes), then you need to enter your passphrase, then once you've entered that and hit enter, you're logged in.

These simple SSH commands are worth remembering to help you manage your Icecast server.

Hard and Soft Commands

If you run the stop or restart commands anyone who is listening will be disconnected, the reload command is best as it keeps your listeners connected, but still applies the changes you've made.

Hard Commands: kick off all listeners and sources

Soft Commands: keeps listeners and sources connected

Future edits to icecast.xml

Any time you wish to change your source or admin passwords, or any of the details of how your Icecast is configured, you simply need to edit the config file again. Fire up PuTTY and execute:

nano /etc/icecast2/icecast.xml

Then just make the changes; hit CTRL+X to exit, type "Y" (without the quotes) to say yes to saving, and overwrite the file before running the "service icecast2 reload" command.

To exit PuTTY you simply type "exit" and hit enter.

Congratulate yourself, big time! You now have a brand new server in the cloud; you've got your head around some complicated stuff, you've installed Icecast, configured it and managed to encode audio from your studio to the server, and now anyone can listen, anywhere in the world.

If you've come here from a traditional FM broadcast background you'll be used to a mile of cables under the flooring; an engineer smoking hash in the stationary cupboard, several rack cabinets full of expensive equipment with flashing lights, signal processors and transmission kit, all of which has just been replaced by a virtual server the cloud.

How long FM has left I don't know, but I do know it can't compete with streaming radio, neither in scale, nor cost.

Has this helped? Why not treat me to an Amazon Gift Card?

Recommended reading I: Control the <audio> tag and build a better stream player

Recommended reading II: Stream your Radio Station on Amazon Alexa devices for free

Recommended reading III: Build Radio Automation in the Cloud and scale to 1,000,000 listeners

© 2020 Andy Moore Privacy Policy Terms and Conditions