Create your own Linux Radio Station
Streaming audio to your local network or even to the Internet is possible on Linux. For those
who like to listen to music wherever they go makes having your own radio station.
This will use some of your network bandwidth, but it is a nice feature to have when you want
music handy everywhere.
Server Details:
IP Address 172.16.10.7/16
OS Centos-7
Install the some requirement packages
# yum groupinstall "Development Tools"
# yum install -y httpd curl-devel libtheora-devel libvorbis-devel libxslt-devel speex-devel libxslt
# systemctl restart httpd
# systemctl enable httpd
# systemctl stop firewalld
# mkdir -p /usr/src/icecast
# cd /usr/src/icecast
# wget http://downloads.xiph.org/releases/icecast/icecast-2.3.3.tar.gz
# tar xf icecast-2.3.3.tar.gz
# cd icecast-2.3.3 Configure Icecast
# ./configure --prefix=/opt/icecast/2.3.3
# make
# make install
# cd /opt/icecast Link the 2.3.3
# ln -s 2.3.3 latest directory to latest
# cd /opt/icecast/latest/etc Edit the icecast.xml
# mv icecast.xml icecast.xml.orig file
# vim icecast.xml
<icecast>
<!-- LIMITS -->
<limits>
<clients>100</clients>
<sources>10</sources>
<threadpool>5</threadpool>
<queue-size>524288</queue-size> This Section
<client-timeout>30</client-timeout> Define the limit
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
<burst-on-connect>1</burst-on-connect>
<burst-size>65535</burst-size>
</limits>
<!-- GENRIC -->
<authentication>
<source-password>password</source-password>
<admin-user>admin</admin-user>
<admin-password>password</admin-password>
</authentication> Define Server
<hostname>localhost</hostname> User, Host, Port
<listen-socket>
<port>8000</port>
</listen-socket>
<fileserve>1</fileserve>
<!-- 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> Define Path to
<logdir>/var/log/icecast</logdir> to the webgui
<pidfile>/var/run/icecast/icecast.pid</pidfile>
<alias source="/" dest="/status.xsl"/>
</paths>
<!-- LOG -->
<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<playlistlog>playlist.log</playlistlog> Define The Log file
<loglevel>1</loglevel>
<logsize>10000</logsize>
<logarchive>1</logarchive>
</logging>
<!-- SECURITY -->
<security>
<chroot>0</chroot>
<changeowner> Icecast Security
<user>icecast</user> Section
<group>icecast</group>
</changeowner>
</security>
</icecast>
:wq (Save & Quit)
Now create a user and a group called icecast as defined in the icecast.xml configuration file-
# groupadd -g 200 icecast
# useradd -d /var/log/icecast -m -g icecast -s /bin/bash -u 200 icecast
# mkdir -p /var/run/icecast
# chown -R icecast:icecast /var/run/icecast
Start the icecast server-
# /opt/icecast/latest/bin/icecast -c /opt/icecast/latest/etc/icecast.xml -b
Starting icecast2
Detaching from the console Press Enter Key
Changed groupid to 200.
Changed userid to 200.
Now Server Is Running. You can check the icecast user and logs -
# ls /var/log/icecast/
access.log error.log playlist.log
Access the icecast server via webgui “http://172.16.10.7:8000”
Now Install & Configure the icec for setup the OGG/Vorbis streaming client
# cd /usr/src/icecast
# wget http://downloads.us.xiph.org/releases/libshout/libshout-2.3.1.tar.gz
# tar xf libshout-2.3.1.tar.gz
# cd libshout-2.3.1
# ./configure --prefix=/opt/icecast/latest
# make
# make install
# cd /usr/src/icecast
# wget http://downloads.us.xiph.org/releases/ices/ices-2.0.2.tar.bz2
# tar xf ices-2.0.2.tar.bz2
# cd ices-2.0.2/
# export PKG_CONFIG_PATH=/opt/icecast/latest/lib/pkgconfig:$PKG_CONFIG_PATH
# ./configure --prefix=/opt/icecast/latest
# make
# make install
Configure the ices client and create your first OGG/Vorbis radio station
# cd /opt/icecast/latest/etc/
# vim ices1.xml
<ices>
<!-- GENERIC --> Defines the
<background>1</background> where the
<pidfile>/var/run/icecast/ices1.pid</pidfile> pid file can
Be found.
<!-- LOGGING -->
<logpath>/var/log/icecast</logpath>
<logfile>ices1.log</logfile> Define The
<logsize>2048</logsize> Log file
<loglevel>3</loglevel>
<consolelog>0</consolelog>
<!-- STREAM -->
<stream>
<metadata> Define
<name>RadioStation 1: OGG</name> Station
<genre>Varios</genre>
<description>Test Radio 1</description>
<url>http://localhost:8000/</url>
</metadata>
<input>
<param name="type">basic</param>
<param name="file">/opt/icecast/latest/etc/playlist1.txt</param>
<param name="random">1</param> Define Song
<param name="once">0</param> Contain File
<param name="restart-after-reread">1</param>
</input>
<instance>
<hostname>localhost</hostname>
<port>8000</port> Define Host
<password>password</password> Password
<mount>/radiostation1</mount>
</instance>
</stream>
</ices>
:wq (Save & Quit)
Create a file , Where define full path of songs (OGG/Vorbis )
# mkdir /music
# cd /music/
Download .ogg format Song
# wget http://www.vorbis.com/music/Epoq-Lepidoptera.ogg -O song1.ogg
# wget http://www.vorbis.com/music/Hydrate-Kenny_Beltrey.ogg -O song2.ogg
# ls
Song1.ogg song2.ogg
# cd /opt/icecast/latest/etc/
# vim playlist1.txt
/music/song1.ogg
/music/ song2.ogg
Note:- You can create this list use find command
# find /music/ -name "*.ogg" > /opt/icecast/latest/etc/playlist1.txt
Start the ices as user icecast
# su - icecast -c "/opt/icecast/latest/bin/ices /opt/icecast/latest/etc/ices1.xml"
Check the log file…
# tail -f /var/log/icecast/ices1.log
[2017-08-30 12:24:40] INFO signals/signal_usr1_handler Metadata update requested
[2017-08-30 12:24:41] INFO playlist-basic/playlist_basic_get_next_filename Loading playlist from file
"/opt/icecast/latest/etc/playlist1.txt"
[2017-08-30 12:24:42] INFO playlist-builtin/playlist_read Currently playing "/music/song2.ogg"
[2017-08-30 12:24:43] INFO stream/ices_instance_stream Connected to server:
localhost:8000/radiostation1
Now First Radio Station Is Ready –
http://172.16.10.7:8000/radiostation1
Now Setup the MP3 streaming
# cd /usr/src/icecast
# wget http://downloads.us.xiph.org/releases/libshout/libshout-2.3.1.tar.gz
# tar xf libshout-2.3.1.tar.gz
# cd libshout-2.3.1
# ./configure --prefix=/opt/icecast/latest
# make
# make install
# cd /usr/src/icecast
# wget http://netcologne.dl.sourceforge.net/project/icegenerator/icegenerator/0.5.5-
pre2/icegenerator-0.5.5-pre2.tar.gz
# tar xfz icegenerator-0.5.5-pre2.tar.gz
# cd icegenerator-0.5.5-pre2
# ./configure
# make
# make install
Create a First Mp3 Radio Station
# cd /usr/local/etc
# vim icegen1.cfg
IP=172.16.10.7
PORT=8000
SERVER=2
MOUNT=/radiostation2
PASSWORD=password
FORMAT=1
MP3PATH=m3u:/usr/local/etc/playlist2.m3u
LOOP=1
SHUFFLE=1
NAME=RadioStation 2: MP3
DESCRIPTION=Test Radio
GENRE=Varios
URL=http://localhost:8000/
LOG=2
LOGPATH=/var/log/icecast/icegen1.log
BITRATE=48000
SOURCE=source
:wq (Save & Quit)
# vim /usr/local/etc/playlist2.m3u
/music /song1.mp3
/music/song2.mp3
# find /music/ -name "*.mp3" > /usr/local/etc/playlist2.m3u
# su - icecast -c "export LD_LIBRARY_PATH=/opt/icecast/latest/lib:$LD_LIBRARY_PATH;
/usr/local/bin/icegenerator -f /usr/local/etc/icegen1.cfg"
Second Radio Station Ready … Access Now
http://172.16.10.7:8000/radiostation2
Monitor Radio Station @Admin Panel
-Ashutosh