So you’re a live DJ or musician, and you want to get some exposure for your skills online. There are various services you can sign up for to host Internet radio stations – Caster.fm and Shoutcast come to mind – but getting their tools to work on Linux is not always trivial.
A fine alternative is Icecast, a GPL-licensed streaming software with an online radio station directory. You can download it here or install it through your Linux distribution’s package manager.
It’s not enough to just install Icecast; you also need a source client, which will connect to the Icecast server and manage the details of the radio station. A number of these exist, but the one I found easiest to use for a simple radio station was the command-line client Ezstream. In this tutorial, I’ll walk you through setting up both Icecast and Ezstream.
Configuring Icecast
First open the file “/etc/icecast2/icecast.xml” with root privileges. You can leave most of it alone, but you’ll want to at least change the authentication passwords. In my case, I also changed the port number to 8001 because the default, 8000, was already in use.
Now start the Icecast server:
On my system, the program is called “icecast,” but on yours it might be called “icecast2.”
The server is now running, but there is no audio stream. You can access your Icecast administration page by opening your browser and visiting 127.0.0.1:8000 (replacing “8000” appropriately if you changed your port number). Enter the username “admin” and the password you set up in icecast.xml. The administration page initially looks like this:
Configuring Ezstream
First you need to make a playlist from some or all of the music you have on your system. If you don’t already have one, here’s a simple command to make a playlist from all of the .mp3 files in your music directory, in alphabetical order:
Icecast also lets you stream in other formats, such as Ogg Vorbis, but I used the mp3 format because that’s what most of my music files are.
If you open the resulting “icecast-playlist.txt” file with a text editor, you’ll see that it’s just a list of tracks with their complete file paths. You can edit this as you please.
Now you’re ready to edit the Ezstream configuration file. Make a directory for it somewhere in your home directory. For example:
The example configuration files are saved in “/usr/share/doc/ezstream” or “/usr/share/doc/ezstream-[version]” in a directory called “examples”. Copy one example file of your choosing into the directory you just made:
Now open up the copy for editing. There are a few things to change here. If you are using a non-standard port, you’ll have to change that in the
Scroll down to the server settings to change the name and description of your station and optionally add a link to your website. At the very end of the file is an option to make your stream public. By default, it looks like this:
If you want your station to be listed on the public Icecast directory, change the “0” to “1.” For this to actually work, you need to set up port forwarding in order to bypass any firewall rules that restrict outside access to your system. I won’t go into that here because the way to set it up varies according to your network settings.
Once you’re satisfied with your ezstream_mp3.xml configuration file, start Ezstream and point it to that file:
Icecast and Ezstream should now be connected! Go back to 127.0.0.1:8000 in your browser. This time, you should see some information:
You can now listen to your own stream by downloading the .m3u file and opening it in a supported player, such as Audacious, or directly opening the URL in your media player.
If someone on your LAN wants to connect to your stream, they must use the same URL but substituting your LAN IP address for “127.0.0.1,” which is just the local loopback address and is the same on every system.
I hope this was as fun for you to set up as it was for me. Do you have an online radio station? How did you set it up? Do you have any tips for beginners?
Ruji Chapnik is a freelance creator of miscellanea, including but not limited to text and images. She studied art at the University of California, Santa Cruz and writing at Portland State University. She went on to study Linux in her bedroom and also in various other people’s bedrooms, crouched anti-ergonomically before abandoned Windows computers. Ruji currently lives in Portland, Oregon. You can find her experiments at rujic.net and her comics at dondepresso.rujic.net.
Our latest tutorials delivered straight to your inbox