Red5 Server Installation on Centos – step by step

-->

Yesterday I installed RED5 server on Centos kernel version 2.6.18-164.el5, RED5 is open source flash server written in java supports streaming audio / video, recording client streams, share objects, live stream publishing and so on.

If you follow the step by step on this page, I am very sure that you will be able to operate the RED5 server on your own, I am pretty confident by using this step by step because I failed to install a few times, and I managed to installed it (a few times too..!). In this tutorial, I am using Centos with kernel version 2.6.18-164.el5.

First, you must fulfill the server’s requirements

Step 1 # Download and Install Java




RED5 server depends on Java. CentOS.

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

Step 2 # Download and Install Ant (Apache Project)

Ant will be used to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory. (ant also can be install using yum, but as of this article being wrote, only ant version 1.6 available on yum repos, you will need atleast ant version 1.7 for newer RED5 server). And you can download it to any folder you want, in this case I am downloading ant to my folder at /home/mohdazam/

# cd /home/mohdazam
# wget http://apache.mirrors.redwire.net/ant/binaries/apache-ant-1.8.0-bin.tar.gz
# tar xvfz apache-ant-1.8.0-bin.tar.gz
# mv apache-ant-1.8.0 /usr/local/ant

Step 3 # Export Variables for Ant and Java

In this step, set the variables for the ant and java, ant will be installed using this step. ;) its real easy..!

# 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

to test if your ant is installed, you can try run the command below

# ant

If the result shows like below

Buildfile: build.xml does not exist!
Build failed

Then ant is successfully installed.

use the command

# ant -version

to check the ant version

example result:

Apache Ant version 1.8.0 compiled on February 1 2010

To make above variables for every user login or for any terminal opens (you will only be able to use ant only in terminal which you set the variables), follow this step, this step is optional.

# 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

Step 4 # Download and Install RED5 Server

In this step, I tried to download and install from tarball, seems like all latest package on the site is broken (got missing files). I suggest you download it from google code using svn. You wil need subversion on your box in order to use the svn. You can check my previous post on how to install subversion.

# 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

that’s mean you have successfully compiled the RED5 server code, the command of “ant dist” will generate / compile the configuration of your RED5 inside the “dist” folder in you RED5 directory (in this case it is inside /usr/local/red5/). Now what you need to do is, just copy the conf/ folder inside /usr/local/red5/dist/ to /usr/local/red5/.

# cp -r dist/conf .

to start the RED5 service, run below command. (or proceed creating init.d script)

# ./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.

Step 5 # Init Script

Create init script for red5 to start, stop and restart easily.

# nano /etc/init.d/red5

Copy and paste it inside the /etc/init.d/red5

#!/bin/sh
# For Centos / Redhat:
# chkconfig: 2345 85 85
# description: Red5
# 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

You can now start | restart | stop | status the RED5 service

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

Step 6 # Test your RED5 server

Now test the RED5 installation by opening following URL in browser

http://your.red5.ip.address:5080/

OR

http://www.yourdomain.com:5080/

you should see your red5 default page on your browser…! :) If you are accessing this port using internet, make sure the port is not blocked!

Step 7 # Configure your red5

If you need to configure your red5 server, just edit the file /usr/local/red5/conf/red5.properties

# nano /usr/local/red5/conf/red5.properties

In this file you can configure your IP / Port number / and so on..after you configure it, restart your red5 server in order to make the changes take effect..

# /etc/init.d/red5 restart



Recent Entries

Leave a Reply