Portal Home > Knowledgebase > VPS Hosting and Dedicated Servers > How to install Red5 Media Server on CentOS VPS and Dedicated Servers


How to install Red5 Media Server on CentOS VPS and Dedicated Servers





1. Install Java using yum. (The -y flag provides a ‘yes’ answer to all prompts.)
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

2. Install the Apache ant binary. I downloaded the most recent release one directly from Apache’s archives. The version installed using yum (and default repositories) will not compile Red5.
cd /usr/src
wget http://archive.apache.org/dist/ant/binaries/apache-ant-1.8.1-bin.tar.bz2
tar xjvf apache-ant-1.8.1-bin.tar.bz2
mv apache-ant-1.8.1 /usr/local/ant

3. Set important Java environment variables.
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

4. You should also add them to bashrc so they’re available the next time you log in.
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

5. Install subversion with yum. If you did a base install of CentOS, subversion will not be preinstalled.
yum -y install subversion

6. Check out the Red5 source.
cd /usr/src
svn co http://red5.googlecode.com/svn/java/server/tags/1_0/ red5

7. Build Red5 with ant.
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist

8. Start Red5.
cp -r dist/conf .
./red5.sh

9. Create a startup script (optional):
vi /etc/init.d/red5
Then enter this text into the file.
#!/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

10. Set permissions on the script.
chmod a+x /etc/init.d/red5
chkconfig red5 on

11. Add necessary ports to the iptables file.
vi /etc/sysconfig/iptables
Then add the following lines:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5080 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1935 -j ACCEPT
You may also want to add exceptions for 8443, 8088, 9035, 1936, and 9999 if necessary for your application,
service iptables restart
You may want to restart the server, and the Red5 test page can be accessed at http://localhost(or servername):5080/



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

* Minimum sign up periods for cPanel Web Hosting plans: Mini - 3mo., Pro - 1mo., Biz - 1mo., cPanel Reseller Hosting, Linux VPS, Windows VPS, Managed cPanel VPS and Dedicated Servers - 1mo. secret link
Accepted payments: Credit/Debit Card, Paypal, Payza, Skrill, WebMoney, CashU, Ukash, paysafecard, Bitcoin, Perfect Money, SolidTrust Pay, OKPay, EgoPay, Western Union/MG, Wire Transfer and more.