RED5 is open source flash server written in java supports streaming audio/video, recording client streams, shared objects, live stream publishing etc.
1. Download and Install Java:
RED5 server depends on Java. Install it using yum.
#yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel
2. Download and Install Ant & Ivy (Apache Project)
Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.
#cd /usr/src
#wget http://mirrors.isu.net.sa/pub/apache//ant/binaries/apache-ant-1.8.2-bin.tar.bz2
#tar jxvf apache-ant-1.8.2-bin.tar.bz2
#mv apache-ant-1.8.2 /usr/local/ant
#cd /usr/src
#svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy
#cd ivy
#ant jar
#cp build/artifact/jars/ivy.jar /usr/local/ant/lib/
3. Export Variables for Ant and Java
#export ANT_HOME=/usr/local/ant
#export JAVA_HOME=/usr/lib/jvm/java
#export PATH=$PATH:/usr/local/ant/bin
Also export these variables in /etc/bashrc to become available for every user login or for any terminal opens.
#echo ‘export ANT_HOME=/usr/local/ant’ >> /etc/bashrc
#echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
#echo ‘export PATH=$PATH:/usr/local/ant/bin’ >> /etc/bashrc
4. Download and Install RED5 Server
#cd /usr/src
#svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
#mv red5 /usr/local/
#cd /usr/local/red5
#ant prepare
#ant dist
You should get at last of this execution as follows:
BUILD SUCCESSFUL
Now copy the conf directory from dist/ and test the red5 installation.
#cp -r dist/conf .
#./red5.sh
If it shows Installer service created in the last then everything is fine here, press ctrl+c and move to next step to create init script.
5. Init Script
Now we are going to create init script for red5 to start, stop and restart easily.
#vi /etc/init.d/red5
The init script code is given bellow:
#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5
# Created By: Andrew Edgar and Jules Sherred
PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid
# Source function library
. /etc/rc.d/init.d/functions
[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5
RETVAL=0
case “$1″ in
start)
echo -n $”Starting $PROG: ”
cd $RED5_HOME
sh $DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG
fi
[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
echo
;;
stop)
echo -n $”Shutting down $PROG: ”
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|status}”
RETVAL=1
esac
exit $RETVAL
Enable executable permission
#chmod +x /etc/init.d/red5
Now start the service
#/etc/init.d/red5 start
Check status
#/etc/init.d/red5 status
red5 (pid XXXXX) is running…
Now test the RED5 installation by opening following URL in browser
http://yourip:5080/
You should see a page as shown bellow:
No comments:
Post a Comment