How to install icecast2 with ices2, a audio streaming server for Debian/Ubuntu

I just installed icecast2 with ices2 on the same machine, which is now a audio streaming server. Icecast2 is a audio streaming server similar to shoutcast. It listens to ices2 that send the audiofiles to the icecast server. Icecast2 sends the audio to the clients.
After installing and configuring icecast2 and ices2 and putting your music in the right directory, you'll have your own internet radio station!

Ices2 supports Ogg Vorbis files only!

1. Installing icecast2

sudo apt-get install icecast2

2. Configuring icecast2

sudo nano /etc/icecast2/icecast.xml

Enter your passwords and usernames between the 'authentication' tags

To enable icecast2 edit the following file and change ENABLE=false to true

sudo nano /etc/default/icecast2

# Defaults for icecast2 initscript
# sourced by /etc/init.d/icecast2
# installed at /etc/default/icecast2 by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Full path to the server configuration file
CONFIGFILE="/etc/icecast2/icecast.xml"

# Name or ID of the user and group the daemon should run under
USERID=icecast2
GROUPID=icecast

# Edit /etc/icecast2/icecast.xml and change at least the passwords.
# Change this to true when done to enable the init.d script
ENABLE=true

Start the icecast2 server:

sudo /etc/init.d/icecast2 start

Now in your webbrowser go to

http://YOU_IP_HERE:8000/

or

http://localhost:8000/

3. Installing ices2

sudo apt-get install ices2

4. Configuring ices2

Create the directories for logs, configuration files and music storage:

mkdir /var/log/ices
mkdir /etc/ices2
mkdir /etc/ices2/music

copy a sample configuration file that comes with the package:

cp /usr/share/doc/ices2/examples/ices-playlist.xml /etc/ices2

edit the configuration file:

sudo nano /etc/ices2/ices-playlist.xml

Change the '0' between the background tags into a '1' and edit your password and the meta info. Also put /etc/ices2/playlist.txt after the param name="file"-tag.

Now put your .ogg files in /etc/ices2/music

Create a plylist file /etc/ices2/playlist.txt and put the path to the .ogg file in it, each on 1 line.

sudo nano /etc/ices2/playlist.txt

like this:

/etc/ices2/music/01-Track01.ogg
/etc/ices2/music/02-Track02.ogg
/etc/ices2/music/03-Track03.ogg
/etc/ices2/music/04-Track04.ogg
/etc/ices2/music/05-Track05.ogg
/etc/ices2/music/06-Track06.ogg
/etc/ices2/music/07-Track07.ogg
/etc/ices2/music/08-Track08.ogg
/etc/ices2/music/09-Track09.ogg
/etc/ices2/music/10-Track10.ogg
/etc/ices2/music/11-Track11.ogg
/etc/ices2/music/12-Track12.ogg

When your done, start ices2:

sudo ices2 /etc/ices2/ices-playlist.xml

5. Add ices2 to the icecast2 init script

this way ices2 will start and stop with icecast2.

sudo nano /etc/init.d/icecast2

modify it to this:

#! /bin/sh
#
# icecast2
#
# Written by Miquel van Smoorenburg .
# Modified for Debian
# by Ian Murdock .
#
# Further modified by Keegan Quinn
# for use with Icecast 2
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/icecast2
NAME=icecast2
DESC=icecast2
ICES=/usr/bin/ices2
ICES_CONFIGFILE=/etc/ices2/ices-playlist.xml

test -x $DAEMON || exit 0

# Defaults
CONFIGFILE="/etc/icecast2/icecast.xml"
CONFIGDEFAULTFILE="/etc/default/icecast2"
USERID=icecast2
GROUPID=icecast
ENABLE="false"

# Reads config file (will override defaults above)
[ -r "$CONFIGDEFAULTFILE" ] && . $CONFIGDEFAULTFILE

if [ "$ENABLE" != "true" ]; then
echo "$NAME daemon disabled - read $CONFIGDEFAULTFILE."
exit 0
fi

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
--exec $DAEMON -- -b -c $CONFIGFILE
sleep 3
start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --oknodo --quiet --exec $ICES

start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
echo "$NAME."
;;
reload|force-reload)
echo "Reloading $DESC configuration files."
start-stop-daemon --stop --oknodo --quiet --exec $ICES
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
sleep 3
start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE
;;
restart)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --oknodo --quiet --exec $ICES

start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
sleep 3
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
--exec $DAEMON -- -b -c $CONFIGFILE
sleep 3
start-stop-daemon --start --quiet --exec $ICES $ICES_CONFIGFILE
echo "$NAME."
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac

exit 0

That's all folks!

ที่มา : http://sudosys.be/?q=icescast2_ices2_audio_streaming_server