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.
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.
Have you checked it by running
/usr/local/red5/red5.sh
Is it run fine like this ?
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!
/usr/local/red5/red5.sh
Is it run fine like this ?
.. i think my probleme is there
What you see at the last when you run
/usr/local/red5/red5.sh
Can you post last few lines using http://paste.to/
Regards,
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
Be sure you have updated version of ANT 1.7.1.
What this command shows
# ant -version
# echo $ANT_HOME
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?
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/
[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
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
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
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. 🙂
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
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
Hi Sohali Riaz,
Red5 working now. thanks for your help.
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
this init script not works for me, please paste this to dpaste.org?
/etc/init.d/red5 status
Usage: /etc/init.d/red5 {start|stop|restart|status}
🙁
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
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.
@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.
@Maxim: Just like Catalin said, fix quotes as its not copy and paste exactly. I will fix my blog for quotes.
@Robert: You are welcome.
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
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,
Ali Khan
-bash: svn: command not found
also -bash: yum: command not found
install this first
yum install subversion
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
@Ali: Your VPS doesnt have YUM a installer through which we can easily install linux software. To install YUM on CentOS VPS you have to use my another post i.e
http://www.sohailriaz.com/howto-install-yum-on-centos-52-vps/
***********************************************
when you will done with this then you can issue a command
yum -y install subversion
and you can have svn to install RED5.
***********************************************
Regards,
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
@ 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
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
@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,
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.
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
Ali Khan
first try to remove your old Ant 1.6.5
yum remove ant
@ 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
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
@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.
@ 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 ??
@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
@jpiazza: You have to edit red5_dir/conf/red5-core.xml and enable RTMPT and RTMPTS section. They are disable bydefault.
@ 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)
@Ali: Can it be possible that i can check your server by myself, contact me using my contact us page.
———
Regards,
I have sent u message via contact us page
Ali Khan
vi /etc/bashrc
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 🙁
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!
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