Install RED5 server on Linux
Following blog post will describe how
to install RED5 server on Centos 5.7 (Final)
Red5 Working :
Red5 server converts the video file to
the flash file and we everyone knows that flash files play instantly
once someone accesses it. Here when we request or select a particular
video, the video script will send the video(stream the video) to red5
server. Red5 will convert the video file to flash and sends the
output to the video script to display on the browser. Lot of video
scripts are being used now a days like dolphin, videowhisper etc for
the site. You can configure the admin panel using the server's IP and
port details.
Installation Steps:
1. Download and Install Java:
Red5 is a JAVA server. So install Java using yum.
[root@server ~]# yum -y install
java-1.6.0-openjdk java-1.6.0-openjdk-devel
2. Install SVN:
SVN will required to fetch latest release
of RED5 source from SVN repository at Google Code.
[root@server ~]# yum install subversion
3. Download and Install Ant &
Ivy:
Ant will need to compile RED5 server
code. Ant comes in binary form, so just download and install it in
/usr/local directory.
First off let’s change to another
directory.
[root@server ~]# cd /usr/src
[root@server src]# wget
http://archive.apache.org/dist/ant/binaries/apache-ant-1.8.2-bin.tar.bz2
[root@server src]# tar jxvf
apache-ant-1.8.2-bin.tar.bz2
[root@server src]# mv apache-ant-1.8.2
/usr/local/ant
[root@server src]# svn co
https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy
[root@server src]# cd ivy
[root@server src]#
/usr/local/ant/bin/ant jar
[root@server src]# cp
build/artifact/jars/ivy.jar /usr/local/ant/lib/
4. Export Variables for Ant and
Java:
So now we have JAVA installed, and ANT
is in place. We need to make sure there are some environment
variables set. These are global variables with paths to different
binaries or applications. ANT and JAVA will need those.
[root@server src]# export
ANT_HOME=/usr/local/ant
[root@server src]# export
JAVA_HOME=/usr/lib/jvm/java
[root@server src]# export
PATH=$PATH:/usr/local/ant/bin
5. Actually Installing the RED5
Server:
Source:
Let’s get the RED5 source:
[root@server src]# svn co
http://red5.googlecode.com/svn/java/server/tags/1_0/ red5
This will fetch the complete Red5
source and save it in a new folder called, red5 (so in /usr/src/red5)
Now that we have the source, let’s
move it to /usr/local/ using
[root@server src]# mv red5 /usr/local/
[root@server src]# cd /usr/local/red5
This is the folder where all the source
files reside. From here on, we prepare and build the red5 source.
[root@server red5]#
/usr/local/ant/bin/ant prepare
[root@server red5]#
/usr/local/ant/bin/ant dist
Wait for few minutes to .
After a few minutes you should end up with the last line in your
terminal window looking like this:
BUILD SUCCESSFUL
This means that you now have a working
RED5 build!
Copy the conf directory from the dist
folder to the current directory and test the red5 installation.
[root@server red5]# cp -r dist/conf .
[root@server red5]# ./red5.sh
Make sure your server is actually
running, you should be able to see the webroot of Red5 when hitting
your server at port 5080 (http://yourserver.com:5080)
Note : That the server is currently
only running as long as you keep that terminal window open. Once you
close it RED5 stops running. Let’s make sure RED5 can run on its
own from now on. Hit CTRL+C to stop the process.
6. Init Script:
Now we will create init script for red5
to start, stop and restart easily.
[root@server ~]# vi /etc/init.d/red5
[Enter the following script into vi.]
#!/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
7. Assign execute permission to red5 script.
[root@server ~]# chmod +x
/etc/init.d/red5
8. Now start the service
[root@server ~]# service red5 start OR
/etc/init.d/red5 start
9. To start RED5 when the server
boots.
[root@server ~]# chkconfig --add red5
[root@server ~]# chkconfig red5 on
10. To Install RED5 demos
[root@server ~]# cd
/usr/local/red5/webapps/root
[root@server root]# svn checkout
http://red5.googlecode.com/svn/java/server/tags/0_9_1/webapps/root/demos/
11. Test
Now test the RED5 installation by
opening following URL in browser.
http://yourserverip:5080/