On this is how to I will describe how to install RED5 server on Centos 5.6.x This how to can be used to install RED5 server on Centos 4, Centos 4, Redhat and Fedora 8 – 11 as well. 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. CentOS 5.6 comes with OpenJDK 1.6 and install it using yum.
yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel java-1.6.0-openjdk-javadoc java-1.6.0-openjdk-src
2) Download and Install Ant (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://apache.sunsite.ualberta.ca/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
or
cd /usr/src/
wget http://apache.forthnet.gr/ant/binaries/apache-ant-1.8.3-bin.tar.bz2
tar jxvf apache-ant-1.8.3-bin.tar.bz2
mv apache-ant-1.8.3 /usr/local/ant
Install IVY
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/
EXPORT VARIABLES FOR ANT AND JAVA RED5
export ANT_HOME=/usr/local/ant export JAVA_HOME=/usr/lib/jvm/java export PATH=$PATH:/usr/local/ant/bin export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
export RED5_HOME=/usr/local/red5
vi /etc/bashrc # ALSO Put the Above Here
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
export RED5_HOME=/usr/local/red5
Now download the latest RED5 CODE from the site to build
Here the latest version available for RED5 is 1.0 on site but download from google code .
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 will see a ton of lines, but you should get at last
BUILD SUCCESSFUL
Personally since red5 last version was not working in my case properly i use red5 0.9.1 so in order to install
cd /usr/src/
svn co http://red5.googlecode.com/svn/java/server/tags/0_9_1 red5-0.9.1.svn
rename
red5-0.9.1.svn to red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist
you will see a ton of lines, but you should get at last
BUILD SUCCESSFUL
that’s mean its install and 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 will create init script for red5 to start, stop and restart easily.
wget http://installer.dazzlesoftware.ca/red5.tar.gz
tar zvfx red5.tar.gz
mv -f red5 /etc/init.d
Now start the service
/etc/init.d/red5 start
check status
/etc/init.d/red5 status
red5 (pid XXXXX) is running…
again you can do stop, restart.
6) Test
Now test the RED5 installation by opening following URL in browser
http://yourip:5080/
http://yourip:5080/demos/
http://yourip:5080/installer/ to install scripts
f you face
HTTP Status 404 - /admin/register.html type Status report message /admin/register.html description The requested resource (/admin/register.html) is not available. Apache Tomcat/6.0.26
if you faced this types of problem then follow this steps
Get the plugins: cd /root/tmp mkdir /usr/local/red5/plugins wget http://red5.googlecode.com/files/AdminPlugin-1.0.zip unzip -d /usr/local/red5/plugins AdminPlugin-1.0.zip
Get the Red5 admin register page: mkdir /usr/local/red5/webapps/admin wget http://red5.googlecode.com/files/admin.jsp mv admin.jsp /usr/local/red5/webapps/admin
then again restart Red5 (/etc/init.d/red5 restart)/(service red5 restart)
Init Script
If you want to create init script for red5 to start, stop and restart easily.
vi /etc/init.d/red5
download http://www.sohailriaz.com/downloads/red5.txt and copy / paste code in it. The init script code also be viewed below.
#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5PROG=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
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROGfi
[ $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
esacexit $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…
again you can do stop, restart.