How To Install RED5 Server on Centos 5.3

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 https://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.

Related Posts

482 thoughts on “How To Install RED5 Server on Centos 5.3

  1. I tried creating the init.d script and I had to change the ”’s to “‘s and when I try to start the script it says it starts fine but when I try to do a status it says: red5 dead but pid file exists so I believe a problem exists somewhere.. any help is appreciated, thanks.

  2. This entire post worked seamlessly for me and saved me hours of time! My previous Red5/Java 1.6 install on CentOS 5.1 was a patchwork monster–can’t thank you enough! Brilliant and really meticulous!

  3. Hi sir,
    this error message show up. any help please?

    thanks

    localhost red5]# ant prepare
    Buildfotile: build.xml

    BUILD FAILED
    /usr/local/red5/build.xml:5: Class org.apache.tools.ant.taskdefs.ConditionTask doesn’t support the nested “antversion” element.

    Total time: 1 second

  4. Hi, I get this error after following your directions exactly. :s

    “BUILD FAILED
    /usr/local/red5/build.xml:220: The following error occurred while executing this line:
    /usr/local/red5/build.xml:241: Error running /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac compiler”
    please help?

  5. Give me output of following command. The problem is in JAVA_HOME
    # echo $JAVA_HOME
    # ls /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    # ls /usr/lib/jvm/

  6. [root@srv ~]# echo $JAVA_HOME

    [root@srv ~]# ls /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    [root@srv ~]# ls /usr/lib/jvm/
    java java-1.6.0-openjdk-1.6.0.0 jre-1.6.0
    java-1.6.0 java-openjdk jre-1.6.0-openjdk
    java-1.6.0-openjdk jre jre-openjdk

  7. Hi Sohali Riaz,
    this is my problem .I updated Ant 1.7.1.

    # ant -version
    but still show up version 1.6.5. how can I change it.
    Please help me

    thanks

  8. You can see the first command of echo doesn’t return any value for $JAVA_HOME.
    See above in the post and please execute all the commands in
    3) Export Variables for Ant and Java

  9. Sohail Riaz, Thank you for the quick response. I figured it out and feel a bit sheepish now.
    the JAVA_HOME was blank. I must have overlooked it.
    Thank you anyways. 🙂

  10. Hi Sohali Riaz,

    [root@localhost ~]# ant -v

    Apache Ant version 1.6.5 compiled on January 6 2007
    Buildfile: build.xml does not exist!
    Build failed

    [root@localhost ~]# echo $ANT_HOME

    BLANK(white screen)

    [root@localhost ~]# echo JAVA_HOME

    JAVA_HOME

  11. First of all you have old version of ant which has this known bug, please update to updated version of 1.7.1.
    Please follow my post step by step and you will have no error.
    Another thing define proper ANT_HOME and JAVA_HOME by seeing above in the post and please execute all the commands in
    3) Export Variables for Ant and Java

  12. Hello,

    I have a problem …. even if the port is listening on the server I still get refused on port tester
    Also seems all the demos are not working.If you can tell me a demo to install and test …

    [root@cs red5]# netstat -napt |grep :1935
    tcp 0 0 :::1935 :::* LISTEN 7388/java
    [root@cs red5]#
    I’ve put on port tester both localhost and the ip
    Still unsuccessfull

    [root@cs red5]# /etc/init.d/red5 status
    red5 (pid 7388) is running…

    A help is very apreciated
    I am new in red5

  13. You should copy/paste it in a notepad/wordpad or any other softwares and modify ex: case “$1″ in with case “$1″ in

    it does not have the correct ” ” ” ” ” ” ” ” and you need to modify them all

  14. Wanted to leave a comment saying thanks for the init script. It was exactly what I was looking for this morning. Just replaced the quotes after copying and pasting, changed the red5 home directory, and it worked perfectly!!

    I’ve tried other init scripts and all failed for one reason or another. Yours it the first that worked with no hassle.

    Thanks again.

  15. @Catalin: Kindly do the following to fix this.
    edit red5_dir/conf/red5-core.xml
    uncomments RTMPT and RTMPTS and restart red5.
    It will fix your error.
    I will update this on my post as i saw this issue 3 days ago with one of my client. For some reason it didnt work for some servers so we have to enable RTMPT and RTMPTS.

  16. I got the following error while installing as I have follow all the above instruction only I have download the red5 from this link instead of above link that you have told
    ——————————————————————
    wget http://dl.fancycode.com/red5/0.6.3/src/red5-0.6.3.tar.gz
    tar -zxf red5-0.6.3.tar.gz
    mv red5-0.6.3 red5

    mv red5 /usr/local/
    cd /usr/local/red5
    ant prepare
    ant dist
    —————————————————-

    I have download the red5 from this method because when ever i want to download red5 as you told in your instruction I always got this error as well

    -bash: svn: command not found

    also -bash: yum: command not found

    —————————————————–

    BUILD FAILED
    /usr/local/red5/build.xml:147: The following error occurred while executing this line:
    /usr/local/red5/build.xml:170: The following error occurred while executing this line:

    —————

    Please guide or help me to solve this problem

    Thanks in advance

  17. you are using old version of red5. If you are willing to use old then use 0.6.2 as its the stable one.
    But i prefer you the latest as i mentioned above
    For the above error of svn and yum before giving you solution can you please tell me which OS you are using Fedora, Centos, Debian etc. with version.
    Regards,

  18. Ali Khan
    -bash: svn: command not found
    also -bash: yum: command not found

    install this first

    yum install subversion

  19. Sohail Riaz

    I am using this OS and version
    OS: Linux 2.6.18-028stab064.7
    Version: psa v8.6.0_build86090814.11 os_CentOS 5

    —————

    eric can you plz guide me how to install subversion, I mean to say any link for downloading and tutorial to install coz im just new ti linux VPS

  20. Thank I have done all the Instruction you have given in your post but only one file not work that is following

    rpm = 4.4.2-48.el5 is needed by rpm-python-4.4.2-48.el5.i386

    but all other file were done

    thn I type this yum list and tons of line appears hope all commands successfully done

  21. @ eric I have done this command also

    yum install subversion and the following result I have got:

    Setting up Install Process
    Parsing package install arguments
    Resolving Dependencies
    –> Running transaction check
    —> Package subversion.i386 0:1.4.2-4.el5_3.1 set to be updated
    –> Processing Dependency: libneon.so.25 for package: subversion
    –> Processing Dependency: neon >= 0.25.5-6.el5 for package: subversion
    –> Running transaction check
    —> Package neon.i386 0:0.25.5-10.el5 set to be updated
    memory alloc (130248 bytes) returned NULL.

    but still I got error on svn i.e.
    -bash: svn: command not found

    any idea

    thanks in advance

  22. I have try red5-0.6.2 the ant prepare command done but ant dist command give me this error

    [javac] 752 problems (752 errors)

    BUILD FAILED
    /usr/local/red5-0.6.2/build.xml:128: The following error occurred while executing this line:
    /usr/local/red5-0.6.2/build.xml:146: Compile failed; see the compiler error output for details.

    Total time: 20 seconds
    ———————–

    Also I have downloaded the latest verion of red5-0.7.0

    and when I give commands Ant prepare I got following error:

    /usr/local/red5/build.xml:5: Class org.apache.tools.ant.taskdefs.ConditionTask doesn’t support the nested “antversion” element.

    any help plz I am new plz

  23. @Ali: the error shown for red5-0.7.0 is still showing you have old version ANT. Kindly reinstall ANT and properly export all variables
    —————-
    @Ali: when you are installing subversion your server is going out of memory. Please try again
    yum -y install subversion
    ———–
    If it not works then install by downloading software from
    http://mirror.centos.org/centos/5/os/i386/CentOS/
    and install subversion and all dependencies.

    Regards,

  24. First off, great tutorial. I have seen a few but this one is as straight forward as it gets. I am having trouble with the “RTMPS&RTMPT server beans not found” errors. I tried uncommenting in the red5-core.xml but no luck. Not sure what I’m doing wrong. Any help would be greatly appreciated.

  25. yum re installed succussfully and I have re install ANT from
    wget http://opensource.become.com/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz

    but I still got
    ant prepare
    Buildfile: build.xml

    BUILD FAILED
    /usr/local/red5/build.xml:5: Class org.apache.tools.ant.taskdefs.ConditionTask doesn’t support the nested “antversion” element.

    I think the ANT version on the URL is old or if you have latest version plz upload it on your site

    I don’t know what is wrong I m still getting this old version as I m re installing correctly :s

    ant -version
    Apache Ant version 1.6.5 compiled on January 6 2007

  26. @ Ali thnaks ANT have been updated

    Ant prepare also Done

    but now When Ant dist given I got this error:

    BUILD FAILED
    /usr/local/red5/build.xml:220: The following error occurred while executing this line:
    /usr/local/red5/build.xml:241: Error running /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac compiler

    Total time: 49 seconds

  27. output of following command.
    # echo $JAVA_HOME
    # ls /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    # ls /usr/lib/jvm/

    [root@ red5]# echo $JAVA_HOME
    /usr/lib/jvm/java
    [root@ red5]# ls /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    [root@r red5]# ls /usr/lib/jvm/
    java java-1.6.0-openjdk-1.6.0.0 jre-1.6.0
    java-1.4.2 java-gcj jre-1.6.0-openjdk
    java-1.4.2-gcj java-openjdk jre-gcj
    java-1.4.2-gcj-1.4.2.0 jre jre-openjdk
    java-1.6.0 jre-1.4.2
    java-1.6.0-openjdk jre-1.4.2-gcj

  28. @Ali: You are not running the export commands. You should execute all of the below and then do ant commands
    ——————————————-
    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
    ——————————————-
    because your echo $JAVA_HOME returns nothing. It should return /usr/lib/jvm/java.

  29. @ Sohail see plz echo $JAVA_HOME returning value

    echo $JAVA_HOME
    /usr/lib/jvm/java

    but still got following error:
    BUILD FAILED
    /usr/local/red5/build.xml:220: The following error occurred while executing this line:
    /usr/local/red5/build.xml:241: Error running /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac compiler
    ————————————

    aslo plz tell when I login to my root I got thiss warning on login that is following:

    -bash: .export: command not found

    plz tell me how do I fix this error and what command is require plz ??

  30. @Ali: give me output of this command
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    ————————
    To fix the export error. If you see its .export means dot export. there is dot before export, please remove that in /etc/bashrc

  31. @ sohail here is the output

    ls /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac

    Output is following:
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac

    Also there is no bashrc directory in etc
    i.e. /etc/bashrc ( there is no directory)

  32. I’m having the same problem “Anthony” mentions in the very first post.
    I installed using this “recipe” (which by the way saved me a lot of time. Thanks Sohail!!!) and when I run “/etc/init.d/red5 start” it says: [OK] but when running “/etc/init.d/red5 status” it says: “red5 dead but pid file exists”

    When I run /usr/local/red5/red5.sh it shows the following errors:

    # /usr/local/red5/red5.sh
    Starting Red5
    Exception in thread “main” java.lang.NoClassDefFoundError: org/red5/server/Bootstrap
    Caused by: java.lang.ClassNotFoundException: org.red5.server.Bootstrap
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)

    Please help 🙁

  33. Hey! I found something weird…
    When I cd into /usr/local/red5 and run “./red5.sh” it starts!
    I get a bunch of stuff, and on the last line:
    “[INFO] [Launcher:/installer] org.red5.server.service.Installer – Installer service created”

    What’s wrong here? Any ideas?
    Something I have to change on the init script?

    Thanks in advance!

  34. Thanks for the guides, through that i was managed to run the red5 easily. But within 3 hrs the “Unable to connect” is in the page. I tried to install it again but the problem remains.

    Please help me in this

Leave a Reply

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