UnixServerAdmin

Server Administration & Management

How to Setting up a Red5 Flash Media Server

Red5 Media Server delivers a powerful video streaming and multi-user solution to the Adobe Flash Player and other exciting client technologies. Based on Java and some of the most powerful open source frameworks.

Red5 includes support for the latest multi-user API’s including NetConnection, NetStream and SharedObject’s while providing a powerful RTMP / Servlet implementation. In addition to support for the RTMP protocol, the application server has an embedded Tomcat Servlet container for JEE Web Applications. Application development draws additional benefits from the Spring Framework and Scope based event driven services.

Installation process of  Red5  Flash Media Server

Install Subversion and Java

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

Install Ant

# cd /opt
# 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 ant
# ln -s /opt/ant/bin/ant /usr/bin/ant

Result: /opt/ant [Export some variables and add to bashrc:]
#export ANT_HOME=/opt/ant
#export JAVA_HOME=/usr/lib/jvm/java
#export PATH=$PATH:/opt/ant/bin
#export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

# echo ‘export ANT_HOME=/opt/ant’ >> /etc/bashrc
# echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
# echo ‘export PATH=$PATH:/opt/ant/bin’ >> /etc/bashrc
# echo ‘export CLASSPATH=.:$JAVA_HOME/lib/classes.zip’ >> /etc/bashrc

Install Red5:

# cd /opt
# svn co http://red5.googlecode.com/svn/java/server/trunk red5
# cd red5
# ant prepare
# ant dist

Create an init script :- By default you have to use red5?s inherent scripts to start/stop, Create a file called /etc/init.d/red5 and past int he following:

################################################################
#!/bin/sh
# For RedHat servers
# description: Red5 flash media server
# processname: red5
PROG=red5
RED5_HOME=/opt/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

#########################################
#######################

# chmod 755 /etc/init.d/red5
# chkconfig red5 on
# service red5 restart

Note that WordPress has a strange way of outputting double quotes, so make sure you address those in the script!

red5 should now run port 5080 and rtmp service on port 1935. You may need to open these ports in your server’s firewall. Test:

http://hostname:5080/demos/port_tester.swf

Advertisements

January 10, 2011 Posted by | Unix/Linux | , | 1 Comment