Wednesday, June 23, 2010

Installing Red5 on CentOS 5.5 64 bit

Step 1
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel


Step 2
yum install subversion

Step 3

wget http://www.apache.org/dist/ant/binaries/apache-ant-1.8.0-bin.zip

Use the latest version of ant available

before doing wget check if the above link is actually working.
Using the latest ant version will save your life a lot of errors.
I had n number of errors which went away by using them.
If by the time you read this blog this guide becomes old and new releases are available just Google latest ant apache version and use that.

Guides can become obsolete since with new updates new steps might be needed.

unzip apache-ant-1.8.0-bin.zip

mv apache-ant-1.8.0 /usr/local/ant

Do not do yum install ant or
yum install ant-*
because when I did yum install ant
and tried to execute it got following error
Class org.apache.tools.ant.taskdefs.ConditionTask doesn't support the nested "antversion" element


Step 4

export ANT_HOME=/usr/local/ant
ln -s /usr/local/ant/bin/ant /usr/local/bin/ant



Step 5

Check ant version (To make sure ant is working)

ant –version



Step 6

INSTALL Red5
Get latest Red5 :
svn co http://red5.googlecode.com/svn/java/server/trunk red5
Build Red5 :
cd red5
ant prepare
ant dist
Move Red5:
cd ..
mv red5 /opt/red5
OPERATE RED5
cd /opt/red5/dist


Start Red5 (when need or on server reboot):
./red5.sh



Step 7

1. Check if red5 is running:
ps aux | grep red5
2. Go to its folder and shut red5 down:
cd /opt/red5/dist
./red5-shutdown.sh
3. See if it’s still running or not:
ps aux | grep red5
4. Restart it, and also make it output the logs into a file of your choice:
./red5.sh > start.log &
5. Make sure it’s back online:
ps aux | grep red5

Step 8 init script to run at boot
in this case

CREATE INIT FILE

vi /etc/init.d/red5

*create the file and paste the script below than save and close by pressing ESC than typing :wq
Insert Red5 init script

#!/bin/sh
# Startup script for Red5 flash streaming server on RedHat/CentOS (cPanel)
# chkconfig: 2345 95 55
# description: Red5 Flash Streaming Server
# processname: red5

PROG=red5
RED5_HOME=/opt/red5/dist
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
# above is 0 if you copy paste from this blog and this does not work just replace o above by #zero

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/$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

Make it executable

chmod a+x /etc/init.d/red5

*usage: /etc/init.d/red5 restart (or start, stop)

Then to be able to see if the script is working or not

use /etc/init.d/red5 start and see in your browser http://IP of server:5080
you should get a red5 working script page.

If you get any problem in executing then probably the copy paste of above script might have given some problem so I have uploaded the script in a text file here on this link
https://docs.google.com/document/edit?id=1dJ40x0mJPaIDXvbMjQQJA6IUBHxhvK2nIYqndFKT1Is&hl=en

Step 9

Always starting at boot Red5
Here is the thread that helped me
http://osflash.org/pipermail/red5_osflash.org/2007-September/015065.html
and steps for this is

Copy the script to /etc/init.d/red5 (chmod 755 red5)

chkconfig --add red5

#start on boot
chkconfig --level 345 red5 on

# usage
service red5 start
service red5 stop
service red5 restart


Step 10
The following is an important blog which helped me for Red5 I modified the script on the blog
init script to run red5 at boot
http://www.chatroulette-clone.com/questions/faq/installing-red5-cpanel/
if some one wants to have a look on it.
Should help them.


References
http://www.videochat-scripts.com/tag/instructions/


http://enbeeone3.com/how-to-install-red5-server-on-centos-5-3

A problem was solved by following thread

http://groups.google.com/group/red5interest/browse_thread/thread/3007c1200fd051ca

Which came as a search result of

http://www.google.co.in/search?q=Class+org.apache.tools.ant.taskdefs.ConditionTask+doesn't+support+the+nested+%22antversion%22+element&hl=en&safe=active&ei=sMwhTK3uL4WWrAebw-XXDg&start=30&sa=N


Instructions available should not be used as it is
http://www.linuxmaza.com/system-administration/howto-install-red5-flash-media-server-in-fedora-11-centos-5-4-redhat/
some steps are wrong

worth checking
http://red5.googlecode.com/svn/java/server/trunk/

init scripts given here interesting
http://wiki.lamsfoundation.org/display/lamsdocs/Installing+a+media+server+(Red5)+for+LAMS
http://red5wiki.com/wiki/Installing_and_running_Red5

2 comments:

Anonymous said...

Hi,
I follow all the steps mentionned in your excellent how-to but when I checked if the red5 server is working fine the following errors apear:
SLF4J: Found binding in [jar:file:/opt/red5/dist/red5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
Could you please on this?
It would be really apreciated.
Thanks a lot.
Geremy

Unknown said...

Hey,

Check this.
http://pankajdangi.com/2010/01/steps-to-install-red5-on-linux/