how-install-red5-centos-54

1. Download and Install Java

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

2. Download and Install Ant


cd /usr/src
wget http://mirrors.kahuki.com/apache/ant/binaries/apache-ant-1.8.1-bin.tar.bz2
tar jxvf apache-ant-1.8.1-bin.tar.bz2
mv apache-ant-1.8.1 /usr/local/ant

3. Export all Variables


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

Make the commands available to everyone on your server:

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
echo 'export CLASSPATH=.:$JAVA_HOME/lib/classes.zip' >> /etc/bashrc

4. Install SVN (Skip if SVN is already installed)


yum install perl-URI
yum install subversion

5. Download and install Red5


cd /usr/src
svn co http://red5.googlecode.com/svn/java/server/tags/0_9_1/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist
cp -r dist/conf .

NOTE: This will install version 0.9.1 of Red5. If you wish to use a previous version, go to – http://red5.googlecode.com/svn/java/server/tags/
and get the link to the version of Red5 you wish to use and substitute it in the “svn co” field.

6. Change Permissions of red5.sh


chmod 755 red5.sh

7. Start Red5


./red5.sh

8. If everything is working fine, test Red5 at http://yourip:5080

9. Make the Init script


nano /etc/init.d/red5

Copy and paste the code below. If your using putty, press ESC and then type :wq to save the init file.


#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5

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

10. Change the permissions of the init file


chmod 755 /etc/init.d/red5

11. Restart and test Red5


/etc/init.d/red5 stop
/etc/init.d/red5 start
/etc/init.d/red5 status
/etc/init.d/red5 restart

12. Add Red5 to your startup init scripts


chkconfig red5 start

Posted in Server Management Tagged with: ,
One comment on “how-install-red5-centos-54
  1. Thanks for informative post. I am pleased sure this post has helped me save many hours of browsing other similar posts just to find what I was looking for. Just I want to say: Thank you!