How To Install RED5 Server on Centos 5.3

on August 16 | in Hosting / Servers, Linux | by | with 477 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.

pixelstats trackingpixel
Pin It

related posts

477 Responses to How To Install RED5 Server on Centos 5.3

  1. Mathieu says:

    This is an new error when i am trying to execute ant prepare: Could not load definitions from resource org/apache/ivy/ant/antlib.xml….

    any idea ?

  2. Franck says:

    Its work fine for me!

    Thank You!!!!!!

  3. Leo Baker says:

    Hello Dean,

    I have finally got Red5 working, but how do I set the username and password to connect to the port 5080: admin panel for red5?

    My other question is how do I setup Flow player to grab a rtmp stream from my folder and play it on a webpage?

    And where shall I upload new files to the webapps, ofldemo, streams?

    Thanks,

    Leo

  4. [...] Reference: corsidiinformaticaonline.it, sohailriaz.com [...]

  5. Alian says:

    I install followed your instructions except red5-0.9.1.zip instead of checkout via svn;
    Red5 has been running up. But I cannot access via http://server_domain:5080/ or http://server_ip:5080;
    Is there something I should do?
    Some information:
    ===========
    OS: CentOS Linux 5.4
    ==========
    netstat -lnp | grep java
    tcp 0 0 0.0.0.0:59083 0.0.0.0:* LISTEN 25907/java
    tcp 0 0 0.0.0.0:1935 0.0.0.0:* LISTEN 25907/java
    tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 25907/java
    tcp 0 0 0.0.0.0:8787 0.0.0.0:* LISTEN 23373/java
    tcp 0 0 0.0.0.0:5080 0.0.0.0:* LISTEN 25907/java
    tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 25907/java
    ==========
    Thanks a lot.

  6. Alian says:

    I know, I should open the ports :1935,9999,55857,5080; Some other ones help me, so I am ok now. Thanks for you
    instructions. Thank you.

  7. XXX says:

    Hi,
    I I met the same problem and Alian,please help me,how can i do.open the ports:1935,9999,5857,5080,or do other.Thank you.

  8. Dean says:

    @ XXX

    Please read the previous posts. I have mentioned how to do this a few times now.

    But to help you, read this or follow the link.

    http://wiki.centos.org/HowTos/Network/IPTables

    You must edit IPtables in your control panel. Eg, through WHM, Pleask, Webadmin.

    If you are not using a control panel, you must edit them manually. Follow the above link to explain how to do it or try the following,

    vi /etc/sysconfig/iptables

    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

    Then save the file (press ESC and then type :wq)

    Then,

    /etc/init.d/iptables restart

    DONE!

    NOTE!!!!
    the line starts with “-A” and ends with “ACCEPT”

    The lines have been wrapped in this post.

  9. XXX says:

    @ Dean,
    Thank you very much!!!!!
    I am ok with you help now,^wholehearted^!!

  10. cafeolai says:

    Hello,
    I successfully installed red5 server on centos 5 . all demos work fine, the only problem I have is that localhost is not conneting, i have to enter the server ip address for the demo to work.
    any idea please ?
    also, I am trying to install red5 recorder but I am struggling. have you got instructions how to install it please?
    Thanks a lot for your help. :)
    Joel

  11. Dean says:

    @cafeolai

    If you are ruinning red5 on a remote server, you have to use the server IP. NOT localhost.

    Only use localhost if you are installing on a local server and accesing red5 from that server.

    I have never installed recorder so I cant help you there. Sorry.

  12. sam says:

    hi
    I install it and i can see java use port 1935 but mydoin:5080 dont work firefox said cant connect
    and also in /usr/local/red5/conf/red5-core.xml I dont see

    <!–

    and RTMPTS
    to uncomment it
    plz plz help me
    thanks alot

  13. XXX says:

    Hi Dean & All,
    I need to you help.now,I have sucessfully install red5 server with you help.and i install one application in ‘/webapps/’ directory.now,I can successfully access “http://ip:5080/messenger7″.
    now,i want to access “http://domain name/messenger7″,but i must be add port number. e.g. “http://domain name:5080/messenger7″.how can i do,disuse port number.with the domain name will be able to access the application.e.g.”http://domain name/messenger7″
    Hope everyone can help me….thanks……

  14. Dean says:

    Hi XXX

    You have only installed a webapp in red5. This is the back end of red5. It like the circuit board in your mobile phone. It runs the phone, you just use the buttons on the front to control it.

    A URL such as http://www.yourdomain.com/messenger7
    is is telling the user to assess a folder on your sever called messenger7 and not the folder in your back end of red5.

    You will need to write a front end to access the back end.

    To do this, simply create an index.html on your http server. When you log into your http server via FTP you should have a “public_html” folder. In this folder creat a messenger7 folder and in the messenger7 folder, create a html file that embeds your red5 application in it.

    You will be able to get the code needed to create the html file from the html file located in the messenger7 webapp folder.

    Hope this helps.

    Regards,

    Dean

  15. Dean says:

    @ Sam,

    Your problem has been answered here already, please read through the previous posts on how to open ports.

  16. XXX says:

    Hi Dean,
    Thank you with you help……..I am trying to create controller for this ……thanks….
    Best Regards,
    XXX

  17. Maurice says:

    I have an issue, I install red5 for a customer and now it get a “red5 dead but pid file exist”, when i view status….where can I check logs to fix issue. Im on plesk, linux, centos 5.x+

  18. jon says:

    How about this error:

    Exception in thread “main” java.lang.ClassFormatError: org.red5.server.Bootstrap (unrecognized class file version)
    at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
    at java.lang.ClassLoader.defineClass(libgcj.so.7rh)
    at java.security.SecureClassLoader.defineClass(libgcj.so.7rh)
    at java.net.URLClassLoader.findClass(libgcj.so.7rh)
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
    at gnu.java.lang.MainThread.run(libgcj.so.7rh)

  19. jon says:

    Wrong java version! fixed it.

  20. mepine says:

    Hi,

    Thank you for your tutorial, I get my red5 running (probably) following this guide, although I’m a newbie for linux/centos/red5.

    However, I cannot open it on browser, with http://127.0.0.1:5080/. ALTHOUGH I can see it says “red5 (pid 3529) is running…”.

    I got 2 different results following you steps, they are probably the problems…

    One is: I cannot find classes.zip under $JAVA_HOME/lib/, but I can get my java is 1.6.0_17, so I just didn’t add it to $CLASSPATH.

    The other is: I didn’t get “Installer service created” but a “Bootstrap complete” but I think it’s just changed since I might get a newer version and the Red5 seems running actually from the command line so I didn’t mind it.

    I got same results with you in other steps, except for the browser testing…

    So do you have any idea of where the problem could be? Or how can I find the problem?

    Thanks very much.

    Pine

  21. Sohail Riaz says:

    @mepine: Kindly change 127.0.0.1 to your server IP address, 127.0.0.1 meant you are accessing your own PC. To get the Red5 site, put the IP on which you install Red5.

    Regards,

  22. mepine says:

    @Sohail

    Thank you for the replying. But yes… this is the virtual machine where I install the red5 server… I cannot either access it from the mac using 192.168.blahblah or access the server in the machine itself using 127.0.0.1. That’s why I feel so strange.

    Thanks.

  23. James M says:

    I’m facing similar issue to mepine above – fully installed as instructed, got the bootstrap complete message – but now when I access REMOTEIP:5080 nothing opens, I’ve also disabled iptables to see if it were a firewall issue but it is not.

    However it does say RED5 is operating when executing the status command.

  24. PanaClips says:

    I’ve installed it succesfully, but I’m running CENTOS 5.5 x86_64 standard on WHM 11.26.20, I’ve installed it thru console and everything worked ok… Now how can I know in which of the 10 ips I have in my dedicated server is? I tried the main IP Address and it was not there…

    The last good thing I did according to this tutorial was:
    # /etc/init.d/red5 status

    And it returned: “red5 (pid 5528) is running…”

    What should I do now?

    Great tutorial BTW!

    Thanks!

  25. Sohail Riaz says:

    @PanaClips: Kindly find following command to check your IP connected with red5,
    #netstat -anpt | grep java
    If you get 0.0.0.0 for 1935 port then its all IPs which you can use for Red5 either it will give you some specific IP. Between its bydefault 0.0.0.0 for all installations.
    ————–
    Regards,

  26. Ali says:

    Hi
    Thank you for your tutorial, I’ve tried to do installation but I have a problem for setting up of RED5 and Appache Ant.

    My problem is that I have a apache already on my host and I couldn’t remove Apache so how can I configure Apache Ant on it?

    Regards,

  27. ImpY says:

    Hey thanks for this tutorial. I’ve done everything step by step and it works fine, till I create the ‘etc/init.d/red’ – Script.
    When I start the script /etc/init.d/red5 start I got those errormessage:

    stop: missing job name
    Try `stop –help’ for more information.
    /etc/init.d/red5: Zeile 49: status}”: command cannot found
    restart: missing job name
    Try `restart –help’ for more information.

    May someone can help me?

  28. Mark says:

    @Impy

    Did you copy and paste the above text into your /init.d/red5 file?

    If so the problem is characters not being copied correctly.

  29. Burim says:

    when i tray to start the red 5 i see the following error

    /root$ /usr/local/red5/red5.sh
    Running on Linux
    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)
    Starting Red5
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
    Could not find the main class: org.red5.server.Bootstrap. Program will exit

    and i can not kreate the script to start and stop red 5
    please help

  30. spoo says:

    Hi, i have the same issue like Maurice

    Red5 start, but when you check with –status ,
    return, Red5 dead but pid file exist

    Any idea

    thank for this great tuto

  31. Dean says:

    Seems to me you have an incompatible version of Java.
    You might need to update your version of java for your version of Centos.

  32. af says:

    Hi —
    When I run: /etc/init.d/red5 restart, I see:
    [INFO] [Launcher:/installer] org.red5.server.service.Installer – Installer service created

    But when I navigate to http://myIP:5080 I can not connect.

    I also see this when I start red5:[INFO] [main] org.red5.server.tomcat.TomcatLoader – Dedicated RTMPT server configuration was not specified
    [INFO] [main] org.red5.server.tomcat.TomcatLoader – Dedicated RTMPS server configuration was not specified

    Can anyone take a guess as to what the problem may be?

    Thanks.

  33. newman says:

    Hello

    Thank you for this tuto. I have the same problem like many peaople. All installation is ok . i start /etc/init.d/red5 start.
    But i can log in to http://myip:5080/
    when i put :
    -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

    i have :
    /etc/init.d/iptables start
    Flushing firewall rules: [ OK ]
    Setting chains to policy ACCEPT: filter [ OK ]
    Unloading iptables modules: [ OK ]
    Applying iptables firewall rules: iptables-restore: line 7 failed
    [FAILED]

    this is my iptables :

    # Firewall configuration written by system-config-securitylevel
    # Manual customization of this file is not recommended.
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -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
    COMMIT

  34. Dean says:

    @ newman

    I have mentioned how to correctly open ports a few times here now. If you read my post (about 18 posts back) it should help you.

    Regards,

    Dean

  35. Reynold P J says:

    Hi Dean,

    First of all thanks for this wonderful post:)
    It would be great if you could explain about the admin panel of red5.

    I tried to access the default admin panel that comes along with red5 installation. The admin panel gives the following error when i try to login
    =============
    NetConnection.Connect.Closed
    =============

    I have checked the firewall rules, and they are opened. If you have any idea, please help.

    Thanks in advance.

  36. Leo says:

    I am on Cent os 5.5 64bit, I have red5 running, when I am playingback flv files, I am getting Pink blocking, and the audio sounds like it is under water then my stream can cut off. I am on a dual core server with 2gb of ram. The file I am trying to play are the smaple flvs which came withthe install the avatar and avatar vp6 as well as my own which are 640×360 flv from Sorenson media using the flash 8 stremaing preset.

    I am using the 0.9.1. Has anyone had this problem before with the pink blcoking like distorted video then image?

    Thanks,

    Leo

  37. Please help me dean

    I have successfully installed red5 0.8.0….
    i am getting successfully my home page by entering the http://myip:5080 but after that..i am confuse how can i add some videos and audio ……mean what should i do on Linux server for using this….

    mean i am unable to identify the how can i use this application for my site like abc.com…

    thanks in advanced….

    Send me some suggestion on my mail id arvindlavania@gmail.com

  38. veo says:

    thanks for info. really nice tutorial..i’ m a newby to linux + streaming..so bear with me.
    installed server..its up n running..oh how do i staart it at boot time?
    is it entailed in the provided script?
    ? (1) do i put vidz in oflademo/stream folder?
    (2) how to access via web?
    (3)are there steps i can follow so i gain access via the web..?
    i appreciate help greatly..
    thanksz again..

  39. Leo says:

    Hello Veo,

    To start as boot time put into SSH this command

    /etc/init.d/red5 start

    1. You can use Winscp and then login with your user/root password and you will be able to add more videos into the oflademo folder.

    /usr/local/red5/webapps/oflaDemo/streams

    2 and 3 I am not sure, do oyu mean how to stream video into a player such as Longtail/JW and Flowplayer via rtmp?

  40. veo says:

    hello alll
    having followed setup from above post…for red5 i see this error at login..
    did i do someting wrong?
    how do i fix it?
    what is the syntax when using client to play file from server?
    which player is recommended(4 pc)?

    thanks 4 ur help
    Last login: Fri Dec 24 21:50:43 2010 from 172.16….
    -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
    -bash: ‘export: command not found
    -bash: ‘export: command not found
    -bash: ‘export: command not found

  41. @veo, I had the same message, for me this was due to the fact that I copied the lines of code directly from this page. This copies the ‘ and ’ as a special character.

    Just “vi /etc/bashrc”
    and remove the offending lines.

    Copy the code form the page to a html/text editor, make sure you replace all the ‘ and ’ with ‘ and try again.

    Hope this helps.

    Thomas

  42. frank says:

    I have the same issue as newman, after updating iptables as per your code I get the following:
    [/usr/local/red5/conf]# /etc/init.d/iptables restart
    Flushing firewall rules: [ OK ]
    Setting chains to policy ACCEPT: mangle filter nat [ OK ]
    Unloading iptables modules: [ OK ]
    Applying iptables firewall rules: Bad argument `NEW’
    Error occurred at line: 17
    Try `iptables-restore -h’ or ‘iptables-restore –help’ for more information.
    [FAILED]

    any additional help would be greatly appreciated, as I have read through the comments thank you

  43. frank says:

    ^ sorry for the double comment.
    I have gotten the ports to listen and port_tester.html shows SUCCESS for RTMP Default and 1935. However, after registering a new admin user and pw I get the following error when attempting to connect:
    NetConnection.Connect.Closed

    I see that Reynold PJ is having the same issue I am on. thanks again Dean.

  44. [...] How To Install RED5 Server on Centos 5.4 In this how to i will describe how to install RED5 server on Centos 5.4.x 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. [...]

  45. kevin says:

    For those of you that get demo page but the demos don’t actually connect. And you are using the right ip and it still doesn’t work.

    Goto install demo. Install ofla demo even if its already installed. Something about this corrects the issue. everytime I install with these instructions I seem to have to do that. Don’t know why.

    Hope that helps.

  46. Dean says:

    ofla demo is not actuve by default. You MUST install in is after setting up red5 for the 1st time.
    This applies to all demo apps that come with red5.

  47. Dean says:

    Stupid fingers can’t type today.. Correction,

    ofla demo is not active by default. You MUST install it after setting up/installing red5 for the 1st time.
    This applies to all demo apps that come with red5.

  48. Ralph says:

    Hi everybody,

    @Reynold P J and everybody else: I cannot access the admin panel . It says NetConnection.Connect.Closed . Everything else works. Tried it on different remote machines, with both 0.9. and 1.0 version. No firewall installed. Very frustrating after 3 full days googling etc . Any help highly appreciated.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

« »