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. kevin says:

    If you like to just get a vps with it installed you can at http://chatcadet.com if you use code: freemonth you can get first month half off.

  2. kevin says:

    If you like to just get a vps with it installed you can at http://chatcadet.com if you use code: FirstMonth you can get first month half off.

  3. Randy says:

    I have followed all instructions listed here step by step and when I try to start red5 I get Permission Denied

  4. Ralph says:

    Hi Randy, whats your OS and other enviroment ?

  5. @Randy: Check the permission of /etc/init.d/red5 and /usr/lcoal/red5/red5.sh … they should be executable..
    —-
    Regards,

  6. Randy says:

    I learn quickly but I am def a newbie when it comes to dedicated servers –

    @Ralph

    CentOS CentOS 5.5-64

    SuperMicro X8DTU-F Intel Xeon QuadCore DualProc SAS/SATA [2Proc]

    @ Sohail

    I am just learning SSH and I am using PUTTY – only know a few commands so if you can tell me who to do what you are suggesting that would save me time from searching for it.

    Thanks for all your help.

  7. @Randy: Ok first tell me.. on which command you get permission denied ?
    ——
    Regards,

  8. Randy says:

    @ Sohail –

    /etc/init.d/red5 start

  9. Randy says:

    OK I

    CHMOD 755 /etc/init.d/red5

    CHMOD 755 /usr/local/red5/red5.sh

    then I entered /etc/init.d/red5 start

    and now I am getting the following:

    /etc/init.d/red5: line 49: stop: command not found
    /etc/init.d/red5: line 49: restart: command not found
    /etc/init.d/red5: line 49: status}.: command not found

  10. Mark says:

    I had this problem. If I remember correctly, it was a typo in the red5 script.

    nano /etc/init.d/red5

    correct the lines….

  11. Dean says:

    @Randy

    Try my instructions here,

    http://www.sohailriaz.com/how-to-install-red5-server-on-centos-53/comment-page-6/#comment-1052

    It tells you what to do exactly.. Step by step.

  12. Randy says:

    OK – now that I have edited the file as suggested by Mark – Red5 starts

    Now when I do the http://ipadd:5080/demos/port_tester.html

    I get FAILED all the way through

    I have looked through this document and followed the steps to uncomment the RTMPT and RTMPS but they were not commented.

    So now what?

  13. Dean says:

    Have you opened the ports in your firewall?

  14. Randy says:

    All up and running – Thank you to all who has helped me with this.

    @Dean – your step by step was right on man – thanks.

  15. Dean says:

    @Randy… Glad they worked for you.. I should write this up on my own site but dont know if I could handle the 100+ questions per day.. lol…

  16. Nithin says:

    my red5 installation stuck on following stage
    kindly please help me
    how many time it will take to install?

    ” [INFO] [main] org.red5.server.tomcat.TomcatLoader – Dedicated RTMPS server configuration was not specified Bootstrap complete [INFO] [Launcher:/] org.springframework.beans.factory.config.PropertyPlaceholderConfigurer – Loading properties file from ServletContext resource [/WEB-INF/red5-web.properties] [INFO] [Launcher:/] org.springframework.beans.factory.support.DefaultListableBeanFactory – Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1535a58: defining beans [placeholderConfig,web.context,web.scope]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@db3331 [INFO] [Launcher:/installer] org.springframework.beans.factory.config.PropertyPlaceholderConfigurer – Loading properties file from ServletContext resource [/WEB-INF/red5-web.properties] [INFO] [Launcher:/installer] org.springframework.beans.factory.support.DefaultListableBeanFactory – Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@177fa9a: defining beans [placeholderConfig,web.context,web.scope,web.handler,installer.service]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@db3331 [INFO] [Launcher:/installer] org.red5.server.service.Installer – Installer service created”

  17. Ammad says:

    Nithin you press ctrl+c

  18. Burim says:

    hi all,
    how can i UPDATE red5 to latest version ??

    thnx

  19. Ali says:

    how to uninstall completely red5

  20. @Ali: Delete directory /usr/local/red5 and delete /etc/init.d/red5 file. This will remove red5 completely. Be remember to stop red5 service before deleting it.
    ————
    Regards,

  21. Vincent says:

    When I try to start Red 5, am greeted by this:

    /etc/init.d/red5: line 42: stop: command not found
    /etc/init.d/red5: line 42: status}.: command not found
    /etc/init.d/red5: line 42: restart: command not found

    I don’t know how to fix this…

  22. Mark says:

    read the older comments, this was answered already.

  23. Dean says:

    @Vincent,

    As Mark said, sift through the older comments. Almost every problem with red5 installation has been answered here.

    I have even written a different method of installing red5 and posted it here.

  24. Stephan says:

    Thank you for that Howto – worked perfectly for me on Centos 5.5 / Ant 1.8.2 / current red5 trunk (Rev. 4217)

  25. Vincent says:

    None of those solutions worked.

  26. Dean says:

    @ Vincent,

    Mate if none of these turiorials work for you then you are simply doing something wrong. It works for me and many others. I am using the latest Centos and Red5 (have used older versions too) and it works just fine.

  27. Vincent says:

    I can get Red5 installed just fine… just not my app…

  28. Dean says:

    Then your app is not compatible with the version of red5 you are using.

  29. Syed Salman Ali Zaidi says:

    Sir, I did everything you said. My Red5 server is up but I have the same problem with RTMPT and RTPMS. In my file there are no lines you mentioned. my file is

    <!– Enable this if you want to allow global scope connections

    –>

    <!– You can now add additional ports and ip addresses

    –>


    <!–

    –>

    –>

    Please give me the reply how can I enable the RTMPT and RTMPS. Waiting from ur side.

    Regards,
    Salman

  30. […] How To Install RED5 Server on Centos 5.4 […]

  31. Emiliano says:

    Hello,
    thank you so much for the post.

    Does anyone know why i can not see the red5 admin?
    I recently installed the 1.0 and i can not access the admin at all.
    I can see the demo admin but i am not sure if that is the same. But even if so, I have not assigned username and password. So, so how can i access?

    thank you

  32. Emiliano says:

    I am trying the :
    # ant prepare
    and i get the following error:

    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create the Java virtual machine.

    any idea on that please?

    thank you

  33. Emiliano says:

    I got throughout ant prepare but i get an error with and dist

    Hello,
    I keep on getting an issue after running the “ant dist”
    ________________________________________

    [ivy:retrieve] :: retrieving :: red5#server
    [ivy:retrieve] confs: [java6]
    [ivy:retrieve] 59 artifacts copied, 0 already retrieved (38469kB/171ms)
    [javac] Compiling 525 source files to /usr/local/red5/bin

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

    Total time: 2 seconds
    ________________________________________

    Any Idea on how i can fix that ?

  34. John says:

    Hi I received bash script error on login to ssh after intall
    any ideas?

  35. @John: I believe you did copy and paste and some of the theme changes characters. Kindly do the following as also written above.

    cd /usr/src
    wget http://www.sohailriaz.com/downloads/red5.txt
    mv red5.txt /etc/init.d/red5
    chmod +x /etc/init.d/red5

    /etc/init.d/red5 start
    /etc/init.d/red5 restart
    /etc/init.d/red5 status
    ———
    Regards,

  36. John says:

    I never got that far i made a java mess.
    after I tried to intall java a few times

    export JAVA_HOME=/usr/lib/jvm/java

    error not configured correctly

    I think bash error coming from here:

    echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc

    How would I remove all instances of java to start from scratch? Centos 5.6 64bit

    Funny thing is this is not the first time I have used you script. It has always gonna flawlessly in the past.

  37. John says:

    When I login ssh this is what i get:

    -bash: .export: command not found
    -bash: .export: command not found
    -bash: .export: command not found
    -bash: .export: command not found
    -bash: .export: command not found
    -bash: .export: command not found
    -bash: .export: command not found
    -bash: .export: command not found

  38. @John: Do the following

    vi /etc/bashrc

    at end of file you will find all these export commands

    delete all of them and leave three lines like this.

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

    Save the file. It will make ant and java environment and will not give any error.
    ——————
    Regards,

  39. John says:

    Error: JAVA_HOME is not defined correctly.
    We cannot execute /usr/local/jdk/bin/java

    I think there is a issue with ant install?

    ant build, test, install give same error

    ANT_HOME=/usr/local/ant
    JAVA_HOME=/usr/lib/jvm/java
    PATH=$PATH:/usr/local/ant/bin
    Have just these three line before end

    with #sudo /usr/sbin/alternatives –config java

    Selection Command
    ———————————————–
    1 /opt/jdk1.6.0_07/bin/java
    *+ 2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

    Thank you for your time
    vi /etc/bashrc

  40. John says:

    please omit last line “vi /etc/bashrc”

  41. @John: OK you have two version of java installed. You can use one of them. The steps mine is only using openjdk.

    You can do following

    JAVA_HOME=/opt/jdk1.6.0_07/

    OR

    JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/

    change this in your /etc/bashrc file.
    —————-
    Regards,

  42. M.Farooq says:

    /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)
    Could not find the main class: org.red5.server.Bootstrap. Program will exit.
    How i can fix it.

  43. Octavio says:

    I installed red5 but the ports tester says everything fails, I changed localhost to the ip address of my server, and went to /usr/local/red5/conf/red5-core.xml but lines to uncomment not even one that says Tomcat. Any suggestions?

    Thanks

  44. Dean says:

    @ Octavio,

    This has been discussed many many mant times here. Read through all the posts. Some where, and may of times, it has been explained that you have to open the ports for red5 in your firewall.

  45. George says:

    Please can someone posts a really working red5-core.xml for version 1.0RC1. Port tester fails every time. Thank you

  46. P.I.Julius says:

    Just wanted to say thanks, your instructions worked perfectly! I have successfully set up on CentOS 5.5 and once enabling the port from iptables everything works perfectly. Thanks again!

  47. Roman says:

    Hi, when i try to start with command /etc/init.d/red5 start
    i have a response: red5 startup: command not found. What is the problem?

  48. @Roman: It can be coy and paste issue. Kindly do the following.

    1)
    rm -f /etc/init.d/red5

    2)
    cd /etc/init.d
    wget http://www.sohailriaz.com/downloads/red5.txt
    mv red5.txt red5
    chmod 644 red5

    3)
    /etc/init.d/red5 start

    ——————
    Regards,

  49. Roman says:

    I’ve done. Starting red5: OK. But when i try command status, response is: red5 dead but pid file exists. End i can’t stop red5

  50. Hi,

    Do the following to track the issue.

    cd /usr/local/red5
    ./red5.sh

    Check where it stops.

    —————-
    Regards,

Leave a Reply

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

« »