How To Install RED5 Server on Centos 5.3

on August 16 | in Hosting / Servers, Linux | by | with 482 Comments

In this how to i will describe how to install RED5 server on Centos 5.3. This how to can be used to install RED5 server on Centos 4 and Fedora 8 – 11 as well. RED5 is open source flash server written in java supports streaming audio/video, recording client streams, shared objects, live stream publishing etc.

1) Download and Install Java

RED5 server depends on Java. CentOS 5.3 comes with OpenJDK 1.6 and install it using yum.

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

2) Download and Install Ant & Ivy (Apache Project)

Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.

cd /usr/src
wget http://mirrors.isu.net.sa/pub/apache//ant/binaries/apache-ant-1.8.2-bin.tar.bz2
tar jxvf apache-ant-1.8.2-bin.tar.bz2
mv apache-ant-1.8.2 /usr/local/ant

cd /usr/src
svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy
cd ivy
ant jar
cp build/artifact/jars/ivy.jar /usr/local/ant/lib/

3) Export Variables for Ant and Java

export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin

Also export these variables in /etc/bashrc to become available for every user login or for any terminal opens.

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

4) Download and Install RED5 Server

Here the latest version available for RED5 is 0.7 on site but download from google code using svn as the tarball of 0.7 on site is missing some of the files.

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 its install and now copy the conf directory from dist/ and test the red5 installation.

cp -r dist/conf .
./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.

5) Init Script

Now we will create init script for red5 to start, stop and restart easily.

vi /etc/init.d/red5

download http://www.sohailriaz.com/downloads/red5.txt and copy / paste code in it. The init script code also be viewed below.

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

Enable executable permission

chmod +x /etc/init.d/red5

Now start the service

/etc/init.d/red5 start

check status

/etc/init.d/red5 status
red5 (pid  XXXXX) is running…

again you can do stop, restart.

6) Test

Now test the RED5 installation by opening following URL in browser

http://yourip:5080/

you will see red5 page like this

red5_11

and demos can be find here.

http://yourip:5080/demos/

red5_21

You can use simple port tester tool that determines which ports the Flash Player is able to connect through to the Red5 server. Put your server address or IP in HOST when using port tester. You should get SUCCESS on RTMP or port 1935. If not please check your firewall.

http://yourip:5080/demos/port_tester.html

red5_3

7) ISSUE

When you run ./red5.sh, it will show you Installer service created. Thats mean everything runs fine and red5 server is up. But if you went to port_tester.swf using demos above or your application shows connections FAILS, this is an issue of RTMPT and RTMPTS. You can see it by running

/usr/local/red5/red5.sh

output trancated

[INFO] [main] org.red5.server.tomcat.TomcatLoader – RTMPT server bean was not found
[INFO] [main] org.red5.server.tomcat.TomcatLoader – RTMPS server bean was not found

output truncated

If you see this you have to uncomment the RTMPT and RTMPTS TomcatLoader in/usr/local/red5/conf/red5-core.xml

vi /usr/local/red5/conf/red5-core.xml

Search for a lines

<!– RTMPT –>
<!–
<bean id=”rtmpt.server” class=”org.red5.server.net.rtmpt.TomcatRTMPTLoader” init-method=”init” lazy-init=”true”>

Remove the <!– from start of <bean and –> from end of </bean>

Same goes for RTMPS

<!– RTMPS –>
<!–
<bean id=”rtmps.server” class=”org.red5.server.net.rtmps.TomcatRTMPSLoader” init-method=”init” lazy-init=”true”>

Remove the <!– from start of <bean and –> from end of </bean>

Restart the red5 services and connection fails problem will be fixed.

If you any question please use comments.

Pin It

related posts

482 Responses to How To Install RED5 Server on Centos 5.3

  1. Dean says:

    @ heru minandar,

    First thing, thanks for providing your exact URL to your Red5 server, I can now use it and get free bandwidth. 🙂
    I highly recomment you remove that link ASAP.
    Second, you did not follow the instructions %100.
    Third, you cannot open the demos simply because you have not installed any.

    Install a ready-made application by clicking the red install link.
    Install ofla demo and then you will see the demo. I could have done this for you seeing you provided a link but I am not like that.

  2. Heru Minandar says:

    dean,
    I already done with install oflademo because when I try again I get this message:
    Application oflaDemo already installed, please un-install before attempting another install

  3. Thanks for the useful information. I really need this topic to share with my friends

  4. al3x says:

    Running it as root is insecure.
    You need to lower privileges to user red5 (fore example).
    1. adduser -d/usr/local/red5 -s/bin/false red5
    into /etc/init.d/red5 add
    USER=”red5″ and in start) replace
    $DAEMON >/dev/null 2>/dev/null &
    with
    daemon –user=$USER $DAEMON >/dev/null 2>/dev/null &
    then it should drop privileges to red5

  5. JuceLan says:

    Hi folk.
    By building Red5 ive got this message:
    BUILD FAILED
    /usr/local/red5/build.xml:4: Class org.apache.tools.ant.taskdefs.ConditionTask doesn’t support the nested “antversion” element.

    Has anyone the same and what can I do?
    JL

  6. Dean says:

    @ JuceLan

    Update ant

  7. Dean says:

    @ heru minandar,

    Did you get the demos running?

  8. JuceLan says:

    @Dean
    How is the Command to update ant ?
    Thanks for Reply
    JL

  9. manuel says:

    hello!

    PROBLEM:

    [FAILED ] red5#jruby-complete;1.1.6!jruby-complete.jar: Downloaded file size doesn’t match expected Content Length for http://red5.googlecode.com/svn/repository/jruby-complete-1.1.6.jar. Please retry. (60805ms)

    thanks….

  10. manuel says:

    i just retried 4 times and it worked

  11. Chris says:

    I am running into an issue that I have seen a few times in here but I can not find an answer. On step two when I attempt to run the “ant jar” command I get a message that command not found.

    How do I correct this?

  12. DavY says:

    Hello,

    I did all instructions and works fine, but i have one problem, when i put my lightIRC webapp in webapp folder from red5, then it says: Scope lightIRC not found and i saw this:

    [WARN] [Launcher:/] org.red5.server.scope.Scope – Invalid scope was not added: [WebScope@1f635484 Depth = 1, Path = ‘/default’, Name = ”]

    How can i fix this?

    Thanks!

  13. bimo says:

    hai dean..
    same problem with heru minandar
    still can’t running demos after installed oflademo and sos sample. please send your tutorial via email..
    thank’s..

  14. cevahir says:

    at first thanks. I install but at last step :

    /etc/init.d/red5 status

    red5 dead but pid file exists

    please help me?

  15. shailesh kumar says:

    svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy
    after above line, it coming errors. i am not able to process next step.
    please help me.

    cd ivy
    ant jar
    cp build/artifact/jars/ivy.jar /usr/local/ant/lib/

    above line cp build….
    not taking next commands.
    please hel me

  16. graha says:

    at first thanks. I install but at last step :
    /etc/init.d/red5 status
    red5 dead but pid file exists
    please help me?

  17. I am says:

    hi

    i cant find u mentioned lines in /usr/local/red5/conf/red5-core.xml.

    Please help me. other things goes fine

  18. […] How To Install RED5 Server var dd_offset_from_content=40;var dd_top_offset_from_content=0; […]

  19. […] Adapted from http://www.sohailriaz.com/how-to-install-red5-server-on-centos-53/ Tagged with: cpanel • server administration • web admin  About the […]

  20. […] Could not create the Java virtual machine. Same error message came up according to this tutorial: How To Install RED5 Server on Centos 5.3 | Sohail Riaz, Linux and Open Source Blog on the line of "ant jar" while installing Ant. Can you anyone give me a solution to it […]

  21. Rana says:

    Very helpful tutorial. I did find all steps working except one. to checkout, I guess, we will need to retrieve the latest stable version from “http://red5.googlecode.com/svn/java/server/tags/1_0/” instead, which worked for me very well. Thanks.

  22. Hanamesh says:

    Hi,
    I have installed red5 in linux i am able to stream normal RTMP url in jwplayer but i need protucted url i have installed authdemo but it is not working it is giving following error.

    Exception in thread “Launcher:/authdemo” org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘web.context’ defined in ServletContext resource [/WEB-INF/red5-web.xml]: Unsatisfied dependency expressed through bean property ‘clientRegistry’: : Cannot find class [org.red5.demo.auth.Application] for bean with name ‘web.handler’ defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.demo.auth.Application; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.red5.demo.auth.Application] for bean with name ‘web.handler’ defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.demo.auth.Application
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1199)

    please help

    Thanks,
    Hanamesh

  23. anuj kumar says:

    hi,
    how can solve below url please help me asap.
    #service red5 status
    red5 dead but pid file exists

  24. Bonjour , pour l’installation vous avez plus simple fiable et garanty a 100%

    Quel et le prix ?
    Gratuit !
    Ya t’il une inscription ?
    NON
    Comment faire dans ce cas ?

    Ouvré une console SSH

    Command 1 :
    wget http://tchat200.heberg.fr/install/red5.sh
    Command 2 :
    chmod 777 red5.sh
    Command 3 :
    sh red5.sh

    Ensuite ?
    allez boire votre cafĂ© en attendent que l’installation ce termine

    En cas de probléme admin@tchatlove.fr << envoyer mon un email je vous aiderai sous quelques minutes et gratuitement

  25. Bonjour ,

    Pour les personnes qui ont des problĂ©me d’installation je vous conseile de suivre cet documentation elle et en 3 Commande et personelement j’ai jamais eu de problème l’ors de l’instalation de celle si

    http://heberg.fr/forum/index.php/forum/auto-installation/9-installation-red5-serveur-centos-fedora#9

    Amicalement et j’espere que cet documentation vous aidera

  26. zeus says:

    A little modification for Step 1 will be more helpful.
    yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel svn ant

  27. Chavi says:

    How to install red5 webapps name and when install?

  28. Qasim says:

    Hi,
    plz help me how to re-stream rtsp to rtmp and work in IOS and android.

    Thanks in advance.

    Regards,
    Qasim

  29. […] How To Install RED5 Server on Centos … – In this how to i will describe how to install RED5 server on Centos 5.3. This how to can be used to install RED5 server on Centos 4 and Fedora 8 – 11 as well. […]

  30. […] How To Install RED5 Server on Centos 5.3 | Sohail Riaz – In this how to i will describe how to install RED5 server on Centos 5.3. This how to can be used to install RED5 server on Centos 4 and Fedora 8 – 11 as well. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

« »