How To Install Icecast 2.3.3 On CentOS 6.3 Linux

This tutorial explains creating your own streaming audio server with Icecast (OGG/MP3). Icecast was designed to stream any audio file if a appropiate streaming client is available. For OGG/Vorbis you can use ices and for MP3 icegenerator. Here is a small tutorial how to set up Icecast for streaming OGG/Vorbis and MP3.

This article contains the following topics:

Setting up the server: Icecast
Setting up the OGG/Vorbis streaming client: ices
Setting up the MP3 streaming client: icegenerator

 Setting up the server: Icecast

First get the software:

# yum groupinstall “Development Tools”
# yum install -y curl-devel libtheora-devel libvorbis-devel libxslt-devel speex-devel libxslt
# rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# cd /home
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# mkdir -p /usr/src/icecast
# cd /usr/src/icecast
# wget http://downloads.xiph.org/releases/icecast/icecast-2.3.3.tar.gz

Next extract the sources and change into the new driectory:

# tar xf icecast-2.3.3.tar.gz
# cd icecast-2.3.3

Then configure the sources:

# ./configure –prefix=/opt/icecast/2.3.3

And finally compile the sources and install the binaries:

# make
# make install

You should have now the icecast binary under /opt/icecast/2.3.3/latest/bin:

# ls /opt/icecast/2.3.3/bin/

icecast*

Now go into the icecast directory and link the 2.3.3 directory to latest:

# cd /opt/icecast
# ln -s 2.3.3 latest

Now configure icecast by editing the icecast.xml file. First move the orignal sample file to an alternate place:

# cd /opt/icecast/latest/etc
# mv icecast.xml icecast.xml.orig
# vi icecast.xml

Add the following code in files

#################Start#########################

<icecast>

<!– LIMITS –>
<limits>
<clients>10000</clients>
<sources>10</sources>
<threadpool>5</threadpool>
<queue-size>524288</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>30</source-timeout>
<burst-on-connect>1</burst-on-connect>
<burst-size>65535</burst-size>
</limits>

<!– GENRIC –>
<authentication>
<source-password>icecast-password</source-password>
<admin-user>admin</admin-user>
<admin-password>icecast-password</admin-password>
</authentication>
<hostname>intranet.nitidigital.com</hostname>

<listen-socket>
<port>8000</port>
<!– <icecast-mount>/stream.mp3</icecast-mount>–>
</listen-socket>
<fileserve>1</fileserve>

<!– <listen-socket>
<port>8005</port>
<icecast-mount>/custom-stream.mp3</icecast-mount>
</listen-socket> –>
<!– PATHES –>
<paths>
<basedir>/opt/icecast/latest/share/icecast</basedir>
<webroot>/opt/icecast/latest/share/icecast/web</webroot>
<adminroot>/opt/icecast/latest/share/icecast/admin</adminroot>
<logdir>/var/log/icecast</logdir>
<pidfile>/var/run/icecast/icecast.pid</pidfile>
<alias source=”/” dest=”/status.xsl”/>
</paths>
<mount>
<mount-name>/cstream</mount-name>

<!–<fallback-mount>/stream</fallback-mount>
<fallback-override>1</fallback-override>–>
<max-listeners>1000</max-listeners>
<!– <dump-file>/tmp/dump-example1.ogg</dump-file> –>
<hidden>0</hidden>
<!–<fallback-override>1</fallback-override>
<burst-size>65536</burst-size>–>
</mount>
<!–<mount>
<mount-name>/test.mp3</mount-name>

<fallback-mount>/stream</fallback-mount>
<fallback-override>1</fallback-override>
<max-listeners>1000</max-listeners>
<dump-file>/tmp/dump-example1.ogg</dump-file>
<hidden>0</hidden>
<fallback-override>1</fallback-override>
<burst-size>65536</burst-size>
</mount> –>

<mount>
<!–<mount-name>/example-complex.ogg</mount-name> –>
<mount-name>/stream</mount-name>
<hidden>0</hidden>
<fallback-mount>/cstream</fallback-mount>
<fallback-override>1</fallback-override>
<fallback-when-full>1</fallback-when-full>
<intro>/test.mp3</intro>
<!–<username>aaadmin</username>
<password>aaicecast-password</password> –>

<max-listeners>1000</max-listeners>
<!–<dump-file>/tmp/dump-example1.ogg</dump-file>
<burst-size>65536</burst-size>–>
<!– <fallback-mount>/cstream</fallback-mount>
<fallback-override>1</fallback-override>
<hidden>0</hidden>
<fallback-when-full>1</fallback-when-full>
<hidden>0</hidden>
<intro>/example_intro.ogg</intro>
<hidden>1</hidden>
<no-yp>1</no-yp>
<authentication type=”htpasswd”>
<option name=”filename” value=”myauth”/>
<option name=”allow_duplicate_users” value=”0″/>
</authentication>
<on-connect>/home/icecast/bin/stream-start</on-connect>
<on-disconnect>/home/icecast/bin/stream-stop</on-disconnect> –>
</mount>
<fallback-mount>/cstream</fallback-mount>
<fallback-override>1</fallback-override>
<fallback-when-full>1</fallback-when-full>
<intro>/test.mp3</intro>
<!–<username>aaadmin</username>
<password>aaicecast-password</password> –>

<max-listeners>1000</max-listeners>
<!–<dump-file>/tmp/dump-example1.ogg</dump-file>
<burst-size>65536</burst-size>–>
<!– <fallback-mount>/cstream</fallback-mount>
<fallback-override>1</fallback-override>
<hidden>0</hidden>
<fallback-when-full>1</fallback-when-full>
<hidden>0</hidden>
<intro>/example_intro.ogg</intro>
<hidden>1</hidden>
<no-yp>1</no-yp>
<authentication type=”htpasswd”>
<option name=”filename” value=”myauth”/>
<option name=”allow_duplicate_users” value=”0″/>
</authentication>
<on-connect>/home/icecast/bin/stream-start</on-connect>
<on-disconnect>/home/icecast/bin/stream-stop</on-disconnect> –>
</mount>

<!– LOG –>
<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<playlistlog>playlist.log</playlistlog>
<loglevel>3</loglevel>
<logsize>10000</logsize>
<logarchive>1</logarchive>
</logging>

<!– SECURITY –>
<security>
<chroot>0</chroot>
<changeowner>
<user>icecast</user>
<group>icecast</group>
</changeowner>
</security>

</icecast>

####################END################################

The above icecast.xml is very simple. The first section LIMITS defines how many radio stations you maximum want to provide (sources=10), how many clients may connect (clients=100) etc.

The second section GENERIC defines a username, hostname MyHost/IP), port (8000) for the server itself etc.

The section PATHES defines the pathes to the webgui.

Icecast has a small and simple webgui to see what is going on and this section defines where to find the web documents.

The LOGGING section is of course for logging, where and what to log etc.

The SECURITY section defines that the Icecast software itself should run under the user icecast and the group icecast.

Now we need three more things to do: create a user and a group called icecast as defined in the icecast.xml configuration file, create the place for the logs and a place for the pid file.

First create the icecast user with the ID 200 and the group icecast with the ID 200:

# groupadd -g 200 icecast
# useradd -d /var/log/icecast -m -g icecast -s /bin/bash -u 200 icecast

With the -m option set the directory for the logs was automatically created and the second step can be spared. Only the directory for the pid file is now needed:

# mkdir -p /var/run/icecast
# chown -R icecast:icecast /var/run/icecast

Now give it a try and start the icecast server:

# /opt/icecast/latest/bin/icecast -c /opt/icecast/latest/etc/icecast.xml -b

Starting icecast2
Detaching from the console
Changed groupid to 200.
Changed userid to 200.

Your server is now running as your icecast user and logs will be produced under /var/log/icecast:

# ls /var/log/icecast/

access.log  error.log  playlist.log

Check that it is really running:

# pgrep -fl icecast

4434 /opt/icecast/latest/bin/icecast -c /opt/icecast/latest/etc/icecast.xml -b

Also the icecast server should be reachable via webgui under your given hostname and port, EG http://MyHost/IP:8000/, when you have setup one or more stations they will show up here. The user for the administrative webgui is defined in the icecast.xml file above – icecast. The password in this case is password.

 

Categories: IceCast

Comments are closed.