How to Install Red5 on cPanel/WHM (CentOS) server Print

  • 21

Installing Red5 on cPanel/WHM CentOS and RedHat Linux servers

Follow the instructions and Red5 will work on most Linux CentOS servers (most cPanel/WHM, VPS or dedicated). Again, if you have a shared hosting account, please contact your server administrator to install Red5!

*to run the commands below, an FTP account is not enough! You will need Shell (SSH) access and a client for connecting ( ex. PuTTy http://www.putty.org ).

Connecting via SSH:
Download PuTTy from http://www.putty.org, install and start the program than enter your server details:
Host Name (or IP address): root@YOURSERVERIPADDRESS or username@YOURSERVERIPADDRESS
Port: 22 by default or ask your server admin
*ask SSH root access from your hosting administrator

When you are connected, follow these instructions (type in the commands inside the quotes - one command per line):

INSTALL JAVA
Quote:yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

INSTALL ANT
Quote:cd /root/tmp
wget mirrors.aryanict.net/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
EXPORT VARIABLES FOR ANT AND JAVA
Quote: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

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 SVN
Quote:yum install perl-URI

yum install subversion

* if you got the error if not you can skip this step: 
Install Error: Missing Dependency: perl(URI) >= 1.17 ...

Use this
Quote:wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm
rpm -i perl-URI-1.35-3.noarch.rpm

yum install subversion
INSTALL RED5
Quote: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 .
*Red5 0.9 is recommended instead of latest trunk, as shown above
Change Permissions of red5.sh and run it
Quote:chmod a+x red5.sh 

./red5.sh &
CREATE INIT FILE
Quote:vi /etc/init.d/red5
paste the script below than save and close by pressing ESC than typing :wq

Enter the following script into vi. Note: Copy pasting might be buggy, so first copy/paste this script into a local texteditor and make sure all quotes are normal quotes. I ran into this problem. For easy measure: You can download the script here. This version is copy/past-safe

Once you upload it to your server please rename red5.txt and remove .txt from end so it will be just like this - > red5

If you have downloaded the script from above link You can skip this step.

Code:
Quote:#!/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
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 and execute:
Quote:

Since this is unix land, we need to make sure this init script has permissions to actually be executed. Let’s do this! Do it using chmod, like this:

chmod +x /etc/init.d/red5

Now we should be able to start red5 by using this script. Give this a shot

/etc/init.d/red5 start

If your server responds by writing starting Red5: [ OK ], you’re golden. Let’s check the status!

/etc/init.d/red5 status

You should see something like

red5 (pid 11232) is running...

This means that the RED5 server is running on its own. We could close this terminal window and the RED5 server would stay up and running. That’s looking mighty good, right!?

However, whenever we reboot the VPS, the RED5 server won’t start by itself…yet. You know where I’m going with this, right?

In order for RED5 to start when the server boots, we need to do some chkconfig magic. 

First we need to add the RED5 service to chkconfig:

chkconfig --add red5

Now we need to tell chkconfig that red5 should start asap when booting:

chkconfig red5 on

That should do it… Red5 is installed, you have a simple way of restarting the RED5 service and it starts as soon as possible whenever the server starts. I’d say that’s all we need. Let’s have a little applause for yourself. You did it! You have RED5 running on your server! Now go and have fun with it :)


You are done, check if Red5 is running by accessing http://YOUR_SERVER_IP:5080

make these ports accept connections: 1935, 1936, 5080, 8088

on a default cPanel install these ports should be allowed, if not (please ask your server admin) try turning off the firewall for a short time:
WHM -> ConfigServer Security&Firewall -> [Firewall Disable]

If this solves the problem, you must configure csf to accept connections on these ports ( http://www.configserver.com/cp/csf.html ).

If you need any assistance please send an email to "support@aryanict.com" we will be happy to help you.

Was this answer helpful?

« Back