Skip to content
Thanerik edited this page Oct 19, 2014 · 2 revisions

Red5 Media server

Forget it! I have dropped Red5 as the choice of the project to record and upload webcam to the server. The reasons can be found here. But I still kept the guide, as someone still want to use Red5. It works as of 19. October 2014.

Install the dependencies

$ sudo yum groupinstall "Java Development"

$ sudo yum install subversion

Get Apache Maven

Get the link to latest Binary Maven in http://maven.apache.org/download.cgi as tar or zip

$ sudo -s logs in as root user

$ cd ~

$ wget [link]

$ tar -zxvf [file] or $ unzip [file]

$ mv [dir] /usr/local/maven

$ export M2_HOME=/usr/local/maven - adds the M2_HOME environment variable

$ export M2=$M2_HOME/bin - adds the M2 environment variable

$ export PATH=$M2:$PATH - adds M2 environment variable to your path

$ export JAVA_HOME=/usr/lib/jvm/java - make sure that JAVA_HOME is set to the location of your JDK. Better check the location first!

$ mvn --version - to verify that it is correctly installed

Build Red5

$ cd ~

$ svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5 - Download the latest version from Google Code

$ cd red5

$ mvn -Dmaven.test.skip=true -Dclassifier=bootstrap install - This will create the jars; this will also skip the unit tests.

$ mvn dependency:copy-dependencies - This will download all the dependencies into "target", under "dependency"

$ mvn -Dmaven.test.skip=true -Dmaven.buildNumber.doUpdate=false -Dclassifier=bootstrap package - Packages up everything!

Now there's a tar-gz in ~/red5/target - let's unpack it, move it, and use it as our red5 install!

$ cd target

$ tar -zxvf [file]

$ mv [dir] /usr/local/red5

$ cd /usr/local/red5

$ ./red5.sh

If everything is ok then you will see something like this: [INFO] [Launcher:/installer] org.red5.server.service.Installer - Installer service created

Create a init script for red5

nano -w /etc/init.d/red5 - And paste the following code inside the text editor, save and quit it

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

Activate init script:

$ chmod 755 /etc/init.d/red5

$ chkconfig red5 --add

$ chkconfig red5 on

$ /etc/init.d/red5 start - Run it

$ ps aux | grep red5 - Checks if Red5 runs

Install demos

$ cd /usr/local/red5/webapps/root

$ sudo mkdir demos

$ sudo svn checkout http://red5.googlecode.com/svn/flash/trunk/deploy/ demos

Red5

Now Red5 is accessible in http://IP-ADRESS:5080

Sources

Clone this wiki locally