Nerdier

Adjective: Comparative form of nerdy: more nerdy.

Install red5 on a CentOS5 cPanel VDS

A guide to installing the Red5 media server on a CentOS 5 server (though should work the same for 6), it was originally written when I installed it on a cPanel server for a client, though only the last bit is really relevant to cPanel.

Install Java

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

Install Ant

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

Export Varibles for ant and java

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

It might also be worth adding them to your bash file

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

Install Subversion

wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/perl-URI-1.35-3.noarch.rpm
rpm -Uvh perl-URI-1.35-3.noarch.rpm
yum install subversion

Install Red5

cd /usr/src
svn co http://red5.googlecode.com/svn/java/server/tags/0_8_0/red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dis

Create init file

nano /etc/init.d/red5

Paste in the following

#!/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=/usr/local/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

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

Start Red5

/etc/init.d/red5 start

Log into WHM and all the following to the firewall config incoming/outgoing ports

5080,1935,1936,5080,8088

Save and restart lfd+csf

If it all went well, you will be able to access red5 at http://YOUR_SERVER_IP:5080

Comments are currently closed.