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: red5PROG=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/$PROGfi
[ $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
esacexit $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
and demos can be find here.
http://yourip:5080/demos/
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
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 foundoutput 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.
@vigneshwari
maybe you could try to remove java with yum and install it again, afterwards try java -version and look if it works. A whereis should show you the path to Java. Usually yum sets the Environment Variables itself and it should work. I only had problems with the variables at ant. You should also take a look at /etc/bashrc, maybe there is something incorrect.
thanks. i am getting the version correctly but where is shows some different path.
[root@vps3329 red5]# java -version
java version “1.6.0_13”
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode)
[root@vps3329 red5]# whereis
whereis [ -sbmu ] [ -SBM dir … -f ] name…
how to rectify it
whereis java shows the path also
[root@vps3329 red5]# whereis java
java: /usr/bin/java /usr/share/java
where am i wrong? can u please help
i wnt to uninstall java from the server and re-install it again.
how can i do it?
Hi, the init script is giving the following error:
/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
Could you please make a revised version downloadble?
Thanks
I’ve got a strange problem:
to download and installl RED5 when i digit ant prepare it don’ t find build file:
Buildfile: build.xml does not exist!
Build failed
I had the same problem, but that was because getting the server via svn was not downloading the build.xml I solved the problem by downloading one of the stable versions
Hi,
That tutorial is cool, and the discussion is great, witch is interesting since it ‘s hard to find recent discussion about red5
I am using ubuntu 8.0.4 and I was not able to use the tutorial from red5 homepage. there are some mistake in the command line in my opinion
but the following tuto http://www.videochat-scripts.com/install-red5-0-9-on-linux-ubuntu/ works well for me. There s some subtles differences between the 2 tutorials so..
I have red5 working fine and I m able to use the webapps for joomla , run demos and register as admin
However I have a problem with this server: he keeps going down after undertermined amount of time. The only error I was able to find is:
2009-11-09 21:42:52,559 [Red5_Scheduler_Worker-11] ERROR o.r.s.s.QuartzSchedulingServiceJob – Job org.red5.server.net.rtmp.RTMPConnection$KeepAliveJob@36a11e4 execution failed
There is very little doc about that ; that I found and honestly, this goes way beyond my competences.. if anyone has sort of a solution to debug this
Because there is not point using a stream that goes down all 20min.. pretty useless
thanks all
Thank you for the well written tutorial. It helped a lot!
I got red5 installed but when I run the port text, I can only connect to RTMP DEFAULT and RTMP 1935. Everything else fails. I did uncomment red5-core.xml but when I run /usr/local/red5/red5.sh, I get
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)
JAVA_HOME is pointing to the correct location. I think I have two separate problems here but I am lost. Any suggestions?
Thanks!
@TOM: RED5 default ports are 1935 and your connections are successful then its absolutely correct configuration. No need to worry of other port fails as it determine you may be configure RED5 on different ports.
Everything is correct for you, so no worry on that.
————-
Regards,
And your tuto also solved my problem.
For some reasons I personally don’t understand, the server was shutting down when launching it from /usr/local/(share )red5/red5.sh
But there was an auto created ini file in etc/init.d/ and since I run the server with the init.d command, it has never stop since then
Thanks a lot for your tutorial
Dear friend ,
First of all Thanx for your all support docs.
My red5 is running (installed & configured with your tutorial)
How can i configure the admin acceess ?
Thnx in advance
I think you just need to access the admin panel via
http://ip:5080/admin
Since it s your first access, you will be invited to create a username/password
Hi,
I would like to pay somebody to install ed5 on my server. Please onctact me if you can help.
Thanks.
hey man , come in my chat room if you want, we can talk about
http://www.silverdaledubs.org/chat
“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.”
BE MORE SPECIFIC!!!!! PASTE IT WHERE???!!!
You need to move the script to your /etc/init.d/ folder
after installing red5 I already had the init file setup
@metal: Before downloading and pasting, i give you to issue a command
vi /etc/init.d/red5
which opens a vi editor with blank file named red5 in /etc/init.d directory.
And copy the code and paste in it.
Regards,
Starting red5: [ OK ]
red5 (pid 17680) is running…
Unable to connect
Firefox can’t establish a connection to the server at…
Help Pls….
@Mladen: Please check following.
1) Does your server has firewall running, if running please open port 1935.
2) Did you install demo,s. This can be viewed when you opened.
http://yourIP:5080/
you will find a link for install demo, install flaDemo.
——————
Regards,
Sohail Riaz, help pls add to msn
ml**********@ho*****.com
?
hey nice tut. Ran into same error as Tom above , /etc/init.d/red5 status says its running and /etc/init.d/red5 start says “ok” but when i try to connect to the port it times out and i dont see the pages described above.
It all seemed to have worked up to the point where nothing shows when tryin to access it via that port
@Courtney: Kindly send me output of following command,
netstat -an | grep 5080
netstat -an | grep 1935
and your IP.
—————
Regards,
HAPPY NEW YEAR
==============
Error in Ant
BUILD FAILED
/usr/local/red5/build.xml:4: Class org.apache.tools.ant.taskdefs.ConditionTask doesn’t support the nested “antversion” element.
I’ve downloaded latest version of ant where do we need to configure ?
@bijoy: Please reconfirm you have latest version of ANT. Run following command
ant -v
or
ant –version
It should be 1.7x or greater
——————-
Regards,
You are a Guru Sohail bhai… I had tried many things and banged my head many times on the desk, one change, which i know i would have never been able to figure out till Qayamat, was copying back the conf directory from dist to back in downloaded root folder. I had been messing inside the dist folder and did what not.
Your Make-Life-Easier startup script is great!!!
Now all is smooth again… Thanks to your super intelligence.
May Allah Almighty Bless your for ever.
Imran
Yeah i am having the same issue as Courtney the first grep does not work the second one shows and the IP of the box is but it fails to load the page however it shows the pid and its on in the status.
http://64.120.14.115:5080
[root@srv274 init.d]# netstat -an | grep 1935
tcp 0 0 0.0.0.0:1935 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:19350 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:19350 127.0.0.1:59174 ESTABLISHED
tcp 0 0 127.0.0.1:59174 127.0.0.1:19350 ESTABLISHED
Salam,
Today in routine task in office i faced some issues to install Red5 Sever over our live server and found your valuable website, it was awasome configuration which i find over here and we follow all the above steps and install the red5 server successfully.
No one can stop me to pay you special thanks to share such a valuable information.
Remember me in your daily offers.
Thanks
Qasim Sohail Khan
@Matt Nalett: This command doesnt work or it did not show anything.
netstat -an | grep 5080
——————————-
Recheck your firewall again and confirm you have port 5080 is open.
————–
Regards,
@Qasim, Imran: Thanks for the appreciation. Its mean a lot. 🙂
————-
Regards,
Yes it is open on another method of checking the system, i use Plesk and it has tomcat as well and also i noticed if you try to use another type of java update it gets a bit testy. It still has issues but i think i am getting it its mostly a java issue for the chat.
@Sohail Riaz also @Matt Nalett
First of all thanks , for placing wonderfull tutorial,
Hi i am also facing the same problem like Matt Nalett , but somehow he was able to manage this issue,
netstat -an | grep 5080
netstat -an | grep 1935
I am getting the grep of second port but not for the first one,
Please help me to solve this issue ,
Thanks,
Rajiv
@Rajiv: You need to see if there is any exception while running red5 service. To see the exception shut the service and run the command.
cd /usr/local/red5
./red5.sh
———
search for the lines with 5080 port or web interface like words. Paste that error.
————–
Regards,
I had finally got it installed on CentOS and also i found out the biggest issue i had was Tomcat. For those of you who have Plesk and Tomcat. also if you have Plesk you need to open up the ports above in your Built in Firewall and allow incoming and outgoing traffic on them ports in the firewall.
http://chat.newmusicpromote.com
Check out the Chatroom it has RED5 Running it.
also i had to use another RED5 Build then the one above if you want the link just let me know i will give you the distribution download that i had installed on my CentOS box and it works perfectly.
@Sohailbhai
Once again thanks sohailbhai for your great support
@Matt Nalett
hi Matt please provide me the link to use RED5 Build I will try it, I have checked with plesk i dont have Firewall and tomcat installed with plesk,
Thanks and Regards
More Detailed Install
http://www.flashpioneer.com/chat/help/RED5_install_l.htm
Very Basic Install
http://osflash.org/red5/linux-install
Also its best after you install the RED5 you reboot your server and then start RED5 from your command line below. after you are logged into your server after the reboot. I suggest using SSH as root access.
/etc/init.d/red5 start
Also IF you are using a Webcam/Chat Program of VideoWhisper you will need to modify the settings.php file and replace the old connection to the following for RED5 to Connect to it.
$rtmp_server=\”rtmp://64.120.14.115:1935/videowhisper/”;
$rtmp_amf=\”AMF3″\;
Err Remove the TOP with your IP ADDRESS Please Delete that last comment
$rtmp_server=\”rtmp://YOURIPADDRESS:1935/videowhisper/”;
$rtmp_amf=\”AMF3″\;
Thanks Matt
@Matt: I tought you will provide rpm for RED5 but its still the same insallation with old version 0.6.3. When i wrote this post the latest version was 0.7 and now its going to release 1.0.
I have success with 0.6.3 but to use latest improvement and bug fixes we have to move for latest version, therefore i used SVN to get the latest code everytime to build.
I will now use one of my machine and record to demostrate it in video form that people wont be confused and get cleared picture when they installing RED5.
Please put whatever make RED5 installation easier for users.
Thanks a lot for helping all. 🙂
————————————-
Regards,
@ Sohail, yes the SVN File is great however you need to keep in mind not everyone has the same Linux Build or OS system some are a bit more “buggy” and have issues with installing and using the .sh
I noticed with my Box since i have plesk and tomcat that my RED5 Install was a bit more interesting since Tomcat was trying to over-ride the ports and also the plesk built in firewall was not allowing access. I will try to find a RPM Package you all can use but i would suggest just using them links above then do a yum update or something after you have the packages installed.
Very good how to. I managed to get everything working except that the port tester fails. I’m using the latest copy of Red5 on CentOS 5.4. I edited the /usr/local/red5/conf/red5-core.xml file and uncommented the stuff there. I also went as far as disabling the firewall on the system and restarting red5 service. However all ports seem to fail on the port_tester.swf 🙁 Any help would be appreciated. Thanks.
@ Darryl Smith Yes you need to use your IP Address for the PORT TEST not LocalHost. then you should see some responses. Never use localhost for a port test always use the IP address of the system you are using.
For Example
http://64.120.14.115:8080/red5/demos/port_tester.swf
http://64.120.14.115:5080/demos/port_tester.swf
Then you will see localhost remove that and put my ip address in above. you will see both will show the correct ports to use. but as you noticed i used a different access.
I did the installation till end without errors. This link somewhy doesnt open ;/ https://92.61.39.36:5080/
My server is Centos with plesk.
After i do ./red5.sh the last line is “Bootstrap complete”
command:
netstat -an | grep 5080
tcp 0 0 ::ffff:92.61.39.36:8000 ::ffff:88.119.167.115:55080 ESTABLISHED
and command (do nothing):
netstat -an | grep 1935
Maybe anyone can help me?
Okey hmm now i got good message “Installer service created” but than i try open https://92.61.39.36:5080/ web doenst load and my firefox show some error ssl_error_rx_record_too_long