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. @ Kariolis you are suppost to install it to http not the https directory that is a SSL directory and it will not read it well unless you got a SSL Setup.

  2. Yea i know that but that gives my this error:
    Net status: NetConnection.Connect.Failed
    Trying to connect to war location
    Net status: NetConnection.Connect.Failed
    Trying to connect to war location
    Net status: NetConnection.Connect.Failed
    Trying to connect to war location

    And alot of times like this. ;/

  3. Thats mean some how your server is preventing outside connection to Red5 port i.e 1935. Check the firewall and if its enable then accept all connection on port 1935.
    —————
    Regards,

  4. Firewall is disabled but command telnet localhost 1935 shows:
    Trying 127.0.0.1…
    telnet: connect to address 127.0.0.1: Connection refused

    So yea looks like something wrong with that port but i dont get whats wrong is. Thanks for help =)

  5. Red 5 is running and I see http://ip:5080 however installer and admin gives 404.

    Firewall is default set to allow all.

    Commented out red5-core.xml as under 7. Using debian Lenny

    What might be causing this?

  6. Hi all i was installing this on my server and everything went great till the last part and it gives me the error below.

    /etc/init.d/red5 status
    red5 dead but pid file exists

    I have tried for ages to figure the problem out if anyone can help please email

    kr*******@gm***.com











    . Thank you

  7. Hi!
    About problem “/etc/init.d/red5: line 49: stop: command not found…”
    I’m edit /etc/init.d/red5 and then problem has gone:
    #!/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
    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
    }
    case “$1″ in
    start)
    start
    ;;
    stop)
    stop
    ;;
    status)
    status $PROG -p $PIDFILE
    RETVAL=$?
    ;;
    restart)
    stop
    start
    ;;
    *)
    echo $”Usage: $0 {start|stop|restart|status}”
    RETVAL=1
    esac
    exit $RETVAL

  8. Hello Sohail,
    I am getting this error after install . please give solutution for this
    I ran /etc/init.d/red5 status
    got message red5 dead but pid file exists
    then ran /usr/local/red5/red5.sh got below messages
    Running on Linux
    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)
    Used the /etc/init.d/red5 script as shown in the above comments

  9. hello
    i think i have Fedora 8 and it doe not recognize
    yum -y install

    so i am stuck in the first step

    culd you help please?

    thank you

  10. @Anshul: Do one thing run the command as follow….
    cd /usr/local/red5
    ./red5.sh
    then send the output….
    ——————–
    Regards,

  11. @serkan: yum is default package for fedora since fedora core 1. First you sure you dont have the package install.
    run just
    yum
    if it gives command not found, then you need to install yum package. Find below list of package need to install yum properly and if it still gives any dependencies error, install those too.
    * yum
    * python-elementtree
    * python-iniparse
    * python-sqlite
    * rpm-python
    * python-urlgrabber
    * yum-metadata-parser
    * m2crypto

    ————————–
    Regards,

  12. @serkan: Download and install java sdk and skip the first step.
    Do remember you need sdk not jre, because sdk contains javac package which need by ant to compile red5 packages.
    —————————
    Regards,

  13. @serkan: All you need to download it, download it in .bin extension and when downloaded, first give it execute permission
    chmod +x jdkfilename*.bin
    and then execute it
    ./jdkfilename*.bin
    it will install all the things….
    ————-
    Regards,

  14. okay i installed java under /usr/java/jfk…
    at step 4 i get this error
    fyi
    when i check the version of java -version
    it gives me 1.4.2 something like that

    [root@xxx red5]# ant prepare

    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/tools/ant
    launch/Launcher
    Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launch
    r
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: org.apache.tools.ant.launch.Launcher. Program w
    ll exit.

    thank you

  15. eve though i installed java there i still used
    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

    and

    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

    i dont understand what it means so i wanted to inform what i did

    thank you

  16. Excellent “how to”. I tried a bunch of others and this is the only one that worked.

    Thanks so much for sharing your expertise.

  17. okay i changed my server and now trying to set this up with new one
    i did
    ant prepare, i got this BUILD SUCCESSFUL but
    this step i got this ant dist
    [root@ip-xxxx red5]# ant dist
    Buildfile: /usr/local/red5/build.xml
    [taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.

    -library.check:
    [echo] Java: java.home is /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre and the target version is 1.6
    [echo] Ant: ant.home is /usr/local/ant and the target version is Apache Ant version 1.8.0 compiled on February 1 2010

    -java6.check:
    [echo] Using Java 1.6

    prepare:

    compile:
    [echo] javac version: 1.6
    [echo] Not using the Eclipse IDE
    [echo] Compiler adapter name: modern
    [taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.

    compile-core:
    [taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found.

    retrieve:

    BUILD FAILED
    /usr/local/red5/build.xml:217: The following error occurred while executing this line:
    /usr/local/red5/build.xml:231: The following error occurred while executing this line:
    /usr/local/red5/build.xml:176: Problem: failed to create task or type antlib:org.apache.ivy.ant:settings
    Cause: The name is undefined.
    Action: Check the spelling.
    Action: Check that any custom tasks/types have been declared.
    Action: Check that any / declarations have taken place.
    No types or tasks have been defined in this namespace yet

    This appears to be an antlib declaration.
    Action: Check that the implementing library exists in one of:
    -/usr/local/ant/lib
    -/root/.ant/lib
    -a directory added on the command line with the -lib argument

    Total time: 1 second
    [root@ip-xxxx]#

    please help
    thank you

  18. OK so i have followed this to the T. Copy and pasted everything in. I get to the test page at the end and it shows that video that its working. However 2 things

    1) The port tester all ports fail ( I have opened my Firewall even disabled it for the time being but still doesn’t work)

    2) I did the /usr/local/red5/red5.sh to see the errors and i get the below .. appears others are having this problem. (if it helps my main goal here is to get video whisper to work)

    ~~~~ Results ~~~~~

    root@server [~]# /usr/local/red5/red5.sh Running on Linux
    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:319)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)

  19. i thought this was good but i saw it was not
    problem starts here, any ideas pleaseeee?
    ant prepare
    Buildfile: /usr/local/red5/build.xml
    [taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.x ml. It could not be found.

    prepare:

    BUILD SUCCESSFUL
    Total time: 0 seconds

  20. @serkan: Can you please use the older version of ANT 1.7 as i see antlib.xml not found, it may be issue that they have removed that library.
    Please update after using ant 1.7
    ————–
    Regards,

  21. @ Sohail Riaz
    Ok that worked it now says successful on both of the default things.

    However Now i need to get VideoWhisper to work. Unless someone can point me to something that can let me create my own livestream or Ustream site.

  22. Thanks a lot for sharing the knowledge..finally i’m able to install red5 on my centos server..

  23. Hi,

    Can anyone help?
    I have been going through all the steps and they are working fine.

    I did ant prepare and I got BUILD SUCCESSFUL

    but when I did ant dist I got error:

    BUILD FAILED
    /usr/local/red5/build.xml:494: Could not create task or type of type: manifestclasspath.

    Ant could not find the task or a class this task relies upon.

    Please can anyone advice me on how to fix this.

    Thanks

  24. Hi. Great tutorial, congrats. I have made all the steps with no errors. Not I have a problem. After installing I could open the demo page and even install demo apps and cheching the port 5080 and 1935 showed ok but something happened that now when I go to port tester I get fail on all tests and the installer page shows : Trying to connect to war location
    Net status: NetConnection.Connect.Failed.
    I have CentOs 5.4 / Plesk.
    Any idea what could cause that? Thanks a lot.

  25. Hi, this is really a very helpful blog but I hv few problems. After doing vi /etc/init.d/red5 and pasting the code and saving. When I did /etc/init.d/red5 start

    It gave me the error:
    /etc/init.d/red5: line 47: stop: command not found
    /etc/init.d/red5: line 47: restart: command not found
    /etc/init.d/red5: line 47: status}.: command not found

    Please can anyone help me on this. Thanks a lot

  26. i followed your instructions and am getting this

    root@server1 [/usr/local/red5]# ./red5.sh
    Running on Linux
    Starting Red5
    Exception in thread “main” java.lang.NoClassDefFoundError: org/red5/server/Boots trap
    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:319)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)

  27. it now says it is running but i cannot get to port 5080 and i have no firewall running…

  28. nevermind. apparently i had another rtmp server running other than red5 (wowza limited version). it works now. this is a great tutorial. thanks!

  29. hi, i make all like your manual, all it’s ok but i can see anythings when i put http://myip:5080 … i dont’ have firewaal and any other programs running it’s a new machine qith ONLY 3 package java/ant/red5 like upside … what i find it’s that the machine work but DONT accept external connections … what can i do ‘???

  30. Hi, I have installed Red5 and it’s working fine but when I don’t know how to login to the AdminPanel. I hv done http://myip:5080/admin but I got this error HTTP Status 404 – /admin (The requested resource (/admin) is not available.)

    Please can anyone help me on this so that I can be able to create Username and Password for the AdminPanel Demo.

    Thanks

  31. Hello this is a very good tutorial, Just can’t continue to the end because I had problems with ant prepare, it cored cump with the follwing error…

    ant prepare
    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    *** glibc detected *** /usr/lib/jvm/java/jre/bin/java: double free or corruption.

    I do hope you can help me accomplish my goal in installing this.

  32. Hi Sohail,

    Great guide – looks like it’s gotten a lot of people working, but I’m still getting a problem.

    I’ve followed all the steps in the guide and Red5 looks like it’s working in general, but when I go to the port tester it shows FAILED for all port tests (even RTMP 1935)

    I’ve un-commented the RTMPT and RTMPTS tags as suggested in the steps above, restarted red5, same results.

    Can you offer any suggestion as to what might be causing the port tester to fail?

  33. Thanks for the suggestion Sohail.

    I’ve loaded the /installer page and have installed olfaDemo. I’ve re-loaded the /demos/port_tester.html and it still shows “FAILED” for all ports.

    Any further insight would be greatly appreciated.

    Thanks again for your help this far!

Leave a Reply

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