In this tutorial we’ll show you how to setup your very own Internet radio station using Icecast.
Icecast is a flexible, FOSS server that allows you to stream sound and music both to and from the server. Streaming to the server can be done via a music playlist, live broadcast, or relay from another server. For example, there is an iPhone app (Icefall) which simply streams your phone’s microphone input to your Icecast server.
In this scenario, we’re going to use a playlist of music as our source.
Streaming from the Icecast server is the client connection where users listen. Here we’ll use VLC on an iPhone to listen to the stream.
I’m using a brand new Debian 10 VPS which I’m calling “caster.lowend.party”. We’ll install two products:
- Icecast, which is the server
- Ices, which is the streaming provider that will server our playlist to the serve
Install icecast via apt:
apt-get update apt-get -y install icecast2 ices2
Starting out, icecast does not need much configuration – just the server name and passwords. So when asked if you want to configure icecast, say “yes”. Use the hostname for the server name and pick good passwords.
Icecast should start automatically. It’s a normal systemd service so you can make sure it’s up with:
systemctl start icecast
If you ever need to reconfigure icecast, you can use
I’m going to stream one of my favorite old time radio shows, Speed Gibson of the International Secret Police. It’s available for free (not copyrighted) on archive.org in Ogg Vorbis format. Note that ices 2.x only supports Ogg Vorbis. The older 0.x format supports mp3, but it’s legacy now so I won’t be covering it. If you want to install that, you’ll need to manually build ices from source.
There’s no need to run ices as root, so I created a user (raindog308) and then setup the playlist in my home directory. The playlist file (a text file) is just a list of tracks in the order in which to play them.
$ cd /home/raindog308 $ mkdir SGISP $ cd SGISP $ wget 'https://archive.org/compress/SGISP19391202_201708/formats=OGG%20VORBIS&file=/SGISP19391202_201708.zip' $ unzip *.zip $ ls *.ogg | sort -n | sed 's#^#/home/raindog308/SGISP/#' > playlist.txt
That sed fanciness puts the full path to each track into the playlist, which is necessary:
raindog308@caster:~/SGISP$ head playlist.txt /home/raindog308/SGISP/SGISP_1937-01-02.ogg /home/raindog308/SGISP/SGISP_1937-01-09.ogg /home/raindog308/SGISP/SGISP_1937-01-16.ogg /home/raindog308/SGISP/SGISP_1937-01-23.ogg <snip>
Start by copying the example file:
cp /usr/share/doc/ices2/examples/ices-playlist.xml /home/raindog308
Here are the changes I made, bolded. I removed comments to make things easier to read.
<ices> <background>1</background> <logpath>/home/raindog308</logpath> <logfile>ices.log</logfile> <loglevel>4</loglevel> <consolelog>0</consolelog>
I set ices to run in the background, and I pointed the ices logfile to my home directory.
<metadata> <name>Speed Gibson of the International Secret Police</name> <genre>OTR</genre> <description>Speed Gibson of the International Secret Police</description> </metadata>
The comments in the file say the metadata section isn’t used, but you’ll see it in the web interface.
<input> <module>playlist</module> <param name="type">basic</param> <param name="file">/home/raindog308/SGISP/playlist.txt</param> <param name="random">0</param> <param name="restart-after-reread">0</param> <param name="once">0</param> </input>
Note that “file” parameter pointing at our playlist.txt
<instance> <hostname>caster.lowend.party</hostname> <port>8000</port> <password>complex-password</password> <mount>/SGISP</mount> <reconnectdelay>2</reconnectdelay> <reconnectattempts>5</reconnectattempts> <maxqueuelength>80</maxqueuelength> <encode> <nominal-bitrate>64000</nominal-bitrate> <!-- bps. e.g. 64000 for 64 kbps --> <samplerate>44100</samplerate> <channels>2</channels> </encode> </instance>
Note the hostname, port, and password, which is what ices uses to connect. Also, the “mount” will form part of the URL and is the “name” of the stream.
Now start the stream with
raindog308@caster:~$ ices /root/ices-playlist.xml raindog308@caster:~$ ps -ef | grep ices raindog+ 2196 1 6 18:57 ? 00:00:00 ices2 ices-playlist.xml raindog+ 2202 1979 0 18:57 pts/1 00:00:00 grep ices
As you may recall, we configured it to run in the background and we can see that it is doing so.
At this point, we’re up and streaming. Let’s go to the Icecast page on our server and see what’s going on. We surf to http://caster.lowend.party:8000 and find this page:
If you click Administration and enter ‘admin’ and the password you selected, you can see statistics and do some limited administrative tasks like listing clients, etc. but the main configuration is done in the .xml files.
I’m going to use VLC on my iPhone to connect and listen. It’s very easy to configure. After starting the VLC app, tap Network at the bottom. You’ll see a screen like this:
Tap Open Network Stream. You’ll be presented with a page where you can enter the URL of your stream. Note that you must include the http://, the port number (8000), and the mount.
Once you’ve entered the URL, hit Open Network Stream and you will begin streaming.