Your own internet station ( Debian 10 )

Any discussion related to VPS Servers.
User avatar

Topic Author
Wamuran4512CH
JuniorGeek
JuniorGeek
Posts: 236
Registered for: 4 years 2 months
4
Location: Caboolture 4CAB POI FttN / Zürich GigETH DOCSIS 3.1
x 2
x 6
Mood:
Has thanked: 26 times
Been thanked: 32 times
Gender:
Zodiac:
Contact:
Switzerland

Your own internet station ( Debian 10 )

#593

Post by Wamuran4512CH »

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.

Setting Up the VPS

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:

Code: Select all

apt-get update

Code: Select all

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.

Image

Image

Image

Icecast should start automatically. It’s a normal systemd service so you can make sure it’s up with:

Code: Select all

systemctl start icecast

If you ever need to reconfigure icecast, you can use

Code: Select all

dpkg-reconfigure icecast
Setting Up Your Playlist

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.

Code: Select all

$ 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:

Code: Select all

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>
Configuring ices

Start by copying the example file:

Code: Select all

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.

Code: Select all

<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.

Code: Select all

<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.

Code: Select all

<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

Code: Select all

<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

Code: Select all

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:

Image

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.

Client Setup

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:

Image

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.

Image

Once you’ve entered the URL, hit Open Network Stream and you will begin streaming.

Image
Image

https://lowendbox.com/blog/create-your- ... h-icecast/
word count: 942
These users thanked the author Wamuran4512CH for the post:
Rain (Sun Feb 28, 2021 3:58 pm)
Rating: 20%
ImageImageImageImage
The NBN, like Paul Fletcher's diet, needs more fibre - Applied liberally

Tags:

User avatar

Rain
Site Admin
Site Admin
Posts: 257
Registered for: 4 years 2 months
4
Location: Sydney NSW
x 17
x 26
Mood:
Has thanked: 24 times
Been thanked: 63 times
Gender:
Zodiac:
Australia

Re: Your own internet station ( Debian 10 )

#601

Post by Rain »

very nice write up thank you
word count: 6
Everyone should have FTTP for free!

Post Reply

Return to “VPS Servers”