This is a short article on installing, configuring and running an Icecast streaming server on Debian. Everything I describe here should work on Debian 7 with Icecast 2.3.2 and or Icecast Release 2.4-beta3, however I used Icecast server version 2.3.2 on Debian 6.0.7
What is icecast?
Icecast is free server software for streaming multimedia. It currently supports Ogg Vorbis and MP3 audio streams. It can be used to create an Internet radio station, a stream for freinds and family, or your own private playlist stream. I use Icecast to stream my favorite music within my home. By using an audio stream I can listen to my music on any device within my home.
In this article comments and instructions are in this font; commands you enter are in bold, and settings in config files you enter or verify are in italic bold .
I am going to install Icecast and all acillery programs on an OpenVZ virtualized instance of Debian 6.0.7. To find out more about virtualiation see my article; "OpenVZ on Debian" here; http://openvzondeb.blogspot.ca/
To jump to a particular topic or page in this article;
What is Icecast - page one
Installing and configuring Icecast - page two
The web interface - page three
source clients and what they do - page four
setting up on server music directories - page five
Ices2, installation, configuration, and use - page six
Ezstream, installation, configuration and use - page seven
using off streaming server music sources - page eight
Ezstream source from a windows machine - page nine
VLC source from a windows machine - page ten
multiple streams - page eleven
references - page twelve
Icecast streaming server on Debian
A short article on installing, configuring and running an Icecast streaming server on Debian.
Wednesday, 1 January 2014
Install & configure Icecast - page two
To correctly install software on a Debian server, or any linux machine for that matter, you must be or become root. I strongly reccommend that you DO NOT log on as the root account itself, but as a user account and become root by using su or sudo. For more information about server security see my article " Linux Server Hardening " here; http://linuxserverhardening.blogspot.ca/ [ it pertains to centos, but the ideas are universal ]. So, throught this article rather than saying "become root" or prefacing commands with "sudo" I will assume you have become root.
Now, just in case you don't know how to become root, this is what you do;
Sign onto your server with a common user account, either locally [open a terminal, command prompt] or remotely through a terminal session. Putty is a great, free, terminal client that works with both linux and windows machines.
To become root enter
su
or
sudo before every command.
or
sudo su
The difference between the commands are;
su - asks you to enter the root users password
sudo before every command. - asks for your password. Your user id must be in the sudo user's group
sudo su - asks for your password once. Your user id must be in the sudo user's group
Lets begin!
Now, just in case you don't know how to become root, this is what you do;
Sign onto your server with a common user account, either locally [open a terminal, command prompt] or remotely through a terminal session. Putty is a great, free, terminal client that works with both linux and windows machines.
To become root enter
su
or
sudo before every command.
or
sudo su
The difference between the commands are;
su - asks you to enter the root users password
sudo before every command. - asks for your password. Your user id must be in the sudo user's group
sudo su - asks for your password once. Your user id must be in the sudo user's group
Lets begin!
Install & configue Icecast - page three
This the last time I'll say, 'become root'. At the command prompt enter
su
or
sudo su
You don't need to do this, but to verify the debian version;
command; cat /etc/debian_version
output; 6.0.7
and to find out the kernel version;
command; uname -mrs
output; Linux 2.6.32-5-openvz-amd64 x86_64
Make sure your machine is up to date;
apt-get update
apt-get upgrade
I like nano as a text editor and use it exclusively
apt-get install nano
install icecast. [note, Debian and its derivatives (e.g. Ubuntu) name the icecast package 'icecast2'.]
apt-get install icecast2
This will install icecast, and create an associated user & group. You will see something like this scroll up your screen;
...
Adding system user `icecast2' (UID 103) ...
Adding new user `icecast2' (UID 103) with group `icecast' ...
Not creating home directory `/usr/share/icecast2'.
icecast2 daemon disabled - read /etc/default/icecast2.
If you don't read the installation messages closely, you may miss " icecast2 daemon disabled - read /etc/default/icecast2."
su
or
sudo su
You don't need to do this, but to verify the debian version;
command; cat /etc/debian_version
output; 6.0.7
and to find out the kernel version;
command; uname -mrs
output; Linux 2.6.32-5-openvz-amd64 x86_64
Make sure your machine is up to date;
apt-get update
apt-get upgrade
I like nano as a text editor and use it exclusively
apt-get install nano
install icecast. [note, Debian and its derivatives (e.g. Ubuntu) name the icecast package 'icecast2'.]
apt-get install icecast2
This will install icecast, and create an associated user & group. You will see something like this scroll up your screen;
...
Adding system user `icecast2' (UID 103) ...
Adding new user `icecast2' (UID 103) with group `icecast' ...
Not creating home directory `/usr/share/icecast2'.
icecast2 daemon disabled - read /etc/default/icecast2.
If you don't read the installation messages closely, you may miss " icecast2 daemon disabled - read /etc/default/icecast2."
Install & configue Icecast - page four
Edit /etc/default/icecast2 and set ENABLE to true.
nano /etc/default/icecast2
find this text fragment;
# Change this to true when done to enable the init.d script
ENABLE=false
and change ENABLE setting to true
# Change this to true when done to enable the init.d script
ENABLE=true
Now, note that the comments say "# sourced by /etc/init.d/icecast2 " and " # Edit /etc/icecast2/icecast.xml and change at least the passwords." Edit icecast.xml. Most of the settings can stay at their defaults, but you should change all the "hackme" passwords to something you will remember.
nano /etc/icecast2/icecast.xml
Find the authentication section;
<authentication>
<!-- Sources log in with username 'source' -->
<source-password>hackme</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>hackme</relay-password>
<!-- Admin logs in with the username given below -->
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password>
</authentication>
and change the passwords. In this article I use "my1pa55w0rd"; but make sure you use something different.
<authentication>
<!-- Sources log in with username 'source' -->
<source-password>my1pa55w0rd</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>my1pa55w0rd</relay-password>
<!-- Admin logs in with the username given below -->
<admin-user>admin</admin-user>
<admin-password>my1pa55w0rd</admin-password>
</authentication>
The source password is used by the stream source program to stream to the server. The admin password is used by the admin user to access the web admin pages. The relay password is used if the server is used as a stream relay.
To change the location, hostname, admin, and server ID information on the web interface administration "Global Server Stats" page you can add in the following settings right below <hostname>localhost</hostname>
<location>your location, unchaged it defaults to; earth</location>
<admin>your email account or name, unchanged it defaults to; icemaster@localhost</admin>
<fileserve>1</fileserve>
<server-id>version of icecast, or whatever, unchanged it defaults to; icecast 2.3</server-id>
A few things you should make mental note of from the icecast.xml file;
Sources log in with username 'source' - <!-- Sources log in with username 'source' -->
and use the password you set. - <source-password>my1pa55w0rd</source-password>
default number of clients [listeners] is 100 - <clients>100</clients>
default number of sources is 2 - <sources>2</sources>
default listen-socket is port 8000 - <port>8000</port>
logs are saved to /var/log/icecast2 - <logdir>/var/log/icecast2</logdir>
save the file.
nano /etc/default/icecast2
find this text fragment;
# Change this to true when done to enable the init.d script
ENABLE=false
and change ENABLE setting to true
# Change this to true when done to enable the init.d script
ENABLE=true
Now, note that the comments say "# sourced by /etc/init.d/icecast2 " and " # Edit /etc/icecast2/icecast.xml and change at least the passwords." Edit icecast.xml. Most of the settings can stay at their defaults, but you should change all the "hackme" passwords to something you will remember.
nano /etc/icecast2/icecast.xml
Find the authentication section;
<authentication>
<!-- Sources log in with username 'source' -->
<source-password>hackme</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>hackme</relay-password>
<!-- Admin logs in with the username given below -->
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password>
</authentication>
and change the passwords. In this article I use "my1pa55w0rd"; but make sure you use something different.
<authentication>
<!-- Sources log in with username 'source' -->
<source-password>my1pa55w0rd</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>my1pa55w0rd</relay-password>
<!-- Admin logs in with the username given below -->
<admin-user>admin</admin-user>
<admin-password>my1pa55w0rd</admin-password>
</authentication>
The source password is used by the stream source program to stream to the server. The admin password is used by the admin user to access the web admin pages. The relay password is used if the server is used as a stream relay.
To change the location, hostname, admin, and server ID information on the web interface administration "Global Server Stats" page you can add in the following settings right below <hostname>localhost</hostname>
<location>your location, unchaged it defaults to; earth</location>
<admin>your email account or name, unchanged it defaults to; icemaster@localhost</admin>
<fileserve>1</fileserve>
<server-id>version of icecast, or whatever, unchanged it defaults to; icecast 2.3</server-id>
A few things you should make mental note of from the icecast.xml file;
Sources log in with username 'source' - <!-- Sources log in with username 'source' -->
and use the password you set. - <source-password>my1pa55w0rd</source-password>
default number of clients [listeners] is 100 - <clients>100</clients>
default number of sources is 2 - <sources>2</sources>
default listen-socket is port 8000 - <port>8000</port>
logs are saved to /var/log/icecast2 - <logdir>/var/log/icecast2</logdir>
save the file.
The web interface - page five
We noted "# sourced by /etc/init.d/icecast2" in the comments in /etc/default/icecast2. What that means is that is the init file we use to start icecast. You can start icecast without using the init file, but by using it icecast is started and run under the correct user.
/etc/default/icecast2 start
You can now access the icecast web admin pages from the local server at http://localhost:8000/ or from a remote machine [within your network] at your server's IP address, as; http://yourserversIPadr:8000 [ example http://192.168.1.21:8000 ] Once logged on you will see global stats, but of course no stream or user info because there aren't either yet. Once run, icecast will create access.log and error.log files in /var/log/icecast2/.
To kill icecast enter;
/etc/default/icecast2 stop
The icecast streaming server is now installed, configured, and if you were able to access the web pages, running. But as is, by itself, it is not very usefull. To make it work, to make it useful you must feed it a stream with a stream source client.
The thing I always had trouble getting my head around was why a streaming server needed to be fed a stream. By my thinking it should just, you know, take a song and, you know, stream. But it doesn't work that way. You need a client for the stream source. The other thing I had great trouble getting and coming to terms with is the role of the listen-socket, port 8000. Does listen port mean where your clients, your listeners, listen? Or does it mean where your icecast server "listens" for the stream source?
It appears not only does it mean both, but it also means where your icecast server 'listens' for the web admin. I have a hard time accepting that multiple streams can go up, come down, and be administered through the same port, and that it all can be done with no collisions or adverse affects. But it can. So, if you are like me, suspend your disbelief and trust me; It will all work.
From here on, for "your server's IP address" I will use ; 192.168.1.21 and for passwords I'll use "my1pa55w0rd". Remember, you change these to reflect your setup.
/etc/default/icecast2 start
You can now access the icecast web admin pages from the local server at http://localhost:8000/ or from a remote machine [within your network] at your server's IP address, as; http://yourserversIPadr:8000 [ example http://192.168.1.21:8000 ] Once logged on you will see global stats, but of course no stream or user info because there aren't either yet. Once run, icecast will create access.log and error.log files in /var/log/icecast2/.
To kill icecast enter;
/etc/default/icecast2 stop
The icecast streaming server is now installed, configured, and if you were able to access the web pages, running. But as is, by itself, it is not very usefull. To make it work, to make it useful you must feed it a stream with a stream source client.
The thing I always had trouble getting my head around was why a streaming server needed to be fed a stream. By my thinking it should just, you know, take a song and, you know, stream. But it doesn't work that way. You need a client for the stream source. The other thing I had great trouble getting and coming to terms with is the role of the listen-socket, port 8000. Does listen port mean where your clients, your listeners, listen? Or does it mean where your icecast server "listens" for the stream source?
It appears not only does it mean both, but it also means where your icecast server 'listens' for the web admin. I have a hard time accepting that multiple streams can go up, come down, and be administered through the same port, and that it all can be done with no collisions or adverse affects. But it can. So, if you are like me, suspend your disbelief and trust me; It will all work.
From here on, for "your server's IP address" I will use ; 192.168.1.21 and for passwords I'll use "my1pa55w0rd". Remember, you change these to reflect your setup.
stream source clients - page six
Stream source clients and what they do.
What are stream source clients?
Stream source clients take audio input or play lists and streams it to the streaming server. The streaming server then lets one or more listeners listen to the stream. With the streaming server and stream source client [program] split into two distinct programs the source client [and source stream] can be situated anywhere. The stream source does not need to be on the icecast server, it can be, but it also can be half the way around the world.
There are various stream source clients. We will look at three. The icecast project has two source clients, ices2 and ezstream. we will also look at using vlc as a source client.
What are stream source clients?
Stream source clients take audio input or play lists and streams it to the streaming server. The streaming server then lets one or more listeners listen to the stream. With the streaming server and stream source client [program] split into two distinct programs the source client [and source stream] can be situated anywhere. The stream source does not need to be on the icecast server, it can be, but it also can be half the way around the world.
There are various stream source clients. We will look at three. The icecast project has two source clients, ices2 and ezstream. we will also look at using vlc as a source client.
Ices2, install, configure, use - page seven
Ices2
IceS is a source client that streams an audio stream from various possible sources into a stream that is fed to the Icecast streaming server. IceS v2 is a command line application that supports sending an Ogg Vorbis stream to an Icecast server. This can be live audio (e.g. from a sound card) or Ogg Vorbis files from a play list. We will be using a playlist.
Note, Ices2 will only stream ogg format files.
install ices2
apt-get install ices2
AS part of the configuration of Ices we need to create a few necessary directories
mkdir /var/log/ices
mkdir /etc/ices2
You can do a mkdir /etc/ices2/music, but I prefer to create a music user and put all the music for all possible streaming clients in one spot. create a user 'music';
adduser music
You can covert mp3 files to ogg with vlc, VLC works on both linux and windows machines.
There are other free conversion tools available at Vorbis.com [http://www.vorbis.com].
In the music users home directory add an ogg and mp3 directory. Upload [or move] your *.ogg files to /home/music/ogg and your *.mp3 files to /home/music/mp3.
To make a playlist file install tree and use it to create the playlist file.
apt-get install tree
tree -if /home/music/ogg/ > /home/music/ogg/ogg-playlist.txt [note; the 'if' isn't a condition, but command switches, to not print lead characters, and print full path. for more info do tree --help]
and
tree -if /home/music/mp3/ > /home/music/mp3/mp3-playlist.txt
Clean up your newly created playlist.txt files by deleting the lines not containing songs. [the first and last two lines]
nano /home/music/ogg/ogg-playlist.txt
and
nano /home/music/mp3/mp3-playlist.txt
IceS is a source client that streams an audio stream from various possible sources into a stream that is fed to the Icecast streaming server. IceS v2 is a command line application that supports sending an Ogg Vorbis stream to an Icecast server. This can be live audio (e.g. from a sound card) or Ogg Vorbis files from a play list. We will be using a playlist.
Note, Ices2 will only stream ogg format files.
install ices2
apt-get install ices2
AS part of the configuration of Ices we need to create a few necessary directories
mkdir /var/log/ices
mkdir /etc/ices2
You can do a mkdir /etc/ices2/music, but I prefer to create a music user and put all the music for all possible streaming clients in one spot. create a user 'music';
adduser music
You can covert mp3 files to ogg with vlc, VLC works on both linux and windows machines.
There are other free conversion tools available at Vorbis.com [http://www.vorbis.com].
In the music users home directory add an ogg and mp3 directory. Upload [or move] your *.ogg files to /home/music/ogg and your *.mp3 files to /home/music/mp3.
To make a playlist file install tree and use it to create the playlist file.
apt-get install tree
tree -if /home/music/ogg/ > /home/music/ogg/ogg-playlist.txt [note; the 'if' isn't a condition, but command switches, to not print lead characters, and print full path. for more info do tree --help]
and
tree -if /home/music/mp3/ > /home/music/mp3/mp3-playlist.txt
Clean up your newly created playlist.txt files by deleting the lines not containing songs. [the first and last two lines]
nano /home/music/ogg/ogg-playlist.txt
and
nano /home/music/mp3/mp3-playlist.txt
Subscribe to:
Posts (Atom)