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.
By default, recorded audio files saved to /usr/local/red5/webapps/audiorecorder/streams/_definst_.
But I want to save this audio files to my web server, so how can I do this.
Thanks.
hello,
I have an issue when trying to build with ant..When I execute “ant prepare” it executes succeessfully. But after that when I do “ant build” gives an error like this
—————————————————-
Buildfile: /usr/local/red5/build.xml
BUILD FAILED
Target “build” does not exist in the project “Red5”.
—————————————————–
Any Idea..?
After recording audio, when I clicked on “Save” button then save_audio_to_db.php is not executed.
whats the problem?
hi,
Finally I got it. I used the following commands instead of the build command. It was like this
#ant prepare
#ant dist
but when I am starting the red5 service, I cant access it through the 5080 port. It seems some java address binding errors….?
Some Easy Steps to install Red5,
http://www.pankajdangi.com/2010/01/steps-to-install-red5-on-linux
Thanks
Pankaj
I have installed Red5 using the instruction specified. But when I run, red.sh command, I dont see Installer service created mesage. Rather I see the following at the end:
—————
[INFO] [main] org.springframework.context.support.FileSystemXmlApplicationContext – Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@3acc67: startup date [Wed Sep 01 01:14:52 CDT 2010]; parent: ApplicationContext ‘red5.common’
[INFO] [main] org.springframework.beans.factory.support.DefaultListableBeanFactory – Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@169dd64: defining beans [global.clientRegistry,global.serviceInvoker,global.mappingStrategy,global.context,global.handler,global.scope,red5.scopeResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@7976c1
Bootstrap complete
——————————–
When I do, ps -ef | grep red5, here is the output:
——————————–
root 28655 1 90 01:18 pts/3 00:00:03 /usr/bin/java -Dpython.home=lib -Dred5.root=/usr/local/red5 -Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true -Djava.security.debug=failure -cp /usr/local/red5/boot.jar:/usr/local/red5/conf: org.red5.server.Bootstrap
———————————–
I dont see any process on 5080 and my serverip on 5080 does not work. Please help urgent.
Regards
Aun
hi Aun,
It seems there are some conficts with your java packages. Try remove all java packages (if there are no important dependencies). and install only the openjdk and openjdk-devel. And then do a fresh installation of red5. if you are using centsos 5.4 use “#ant dist” command instead of “#ant build”. and then try to start red5.
Thanks for the reply, but i still see the same error: I am on centos 5.5, I tried ant dist, Here is the list of installed java packages on my system:
————————————–
java-1.6.0-openjdk-devel-1.6.0.0-1.13.b16.el5
tzdata-java-2010k-1.el5
java-1.6.0-openjdk-1.6.0.0-1.13.b16.el5
——————————————
Error is still the same, even i got server reloaded with fresh OS 🙂 Thanks for the help and support, waiting for response.
Regards
Aun
I’m stuck at the same problem as Aun. I’m on Centos5.3 with the same java packages.
When I launch the red5.sh it says at the end ‘Bootstrap complete’ instead of ‘Installer service created’.
Thanks in advance
neme,
Did you find any fix for this ? if so then please share it. I am also stucked on the same issue, opened ticket on red5 site, but they are not responding. Thanks
Ragards
Aun
@neme & Aun,
Do you have red5 running at all after completeing the install?
If so, have you installed any apps?
no Dean, Actually we are unable to get Red5 run, it is not showing Installer service created message, rather it shows some boot strap sort of things and hangs there.
Hello all!
After a lot of work, I am finding myself stuck at the same place that Aun & neme. When I run /etc/init.d/red5 status it says it’s running, but when I try and go to http://myip:5080/ it doesn’t connect.
I got the same ‘Bootstrap complete’ message as the others.
If someone find a solution, please be sure to post.
I will write up a slightly different method of installing red5 and post it here in a day or so. I do not have time to do it at work but have all my information at home.
It works fine with Centos 5.4 so I guess it will work find with 5.3.
in the mean time, try this
/etc/init.d/red5 stop
reboot your server either remotely or physically if you are sitting next to it,
then
/etc/init.d/red5 start
I will return soon…
Good luck!
Dean
Many many thanks, we are waiting for instructions from you. Thanks for helping us out, we would appreciate if you can help you soon.
BTW this short term fix did not work, so waiting for full instructions from you. Thank you again 🙂
Regards
Aun
Try my instructions, see how you go
http://www.bunchcuntfridays.com/red5/Red5.txt
Dear Dean,
Thanks man, you rock, its working fine now. Many many thanks
Regards
Aun
No problem,
Glad to hear it worked.
Hope it works for others too.
Well, Dean, your new directions no longer caused the “Bootstrap Complete” and runing ‘ant dist’ Build completes. But, when I ‘./red5.sh’ at the ‘Start Red5’ part of your new directions I get a “Permissions Denied” error. As well, when I try and start or restart red5 with ‘/etc/init.d/red5 restart’ nothing happens. Any ideas?
Thanks!
Hey Dean,
Disregard my last statement. I had to ‘chmod a+x red5.sh’ and then is started working properly. I now go to ‘http://myip:5080’ and I m now seeing the red5 successful installation page!
Thank you so, so much!
You are my hero. 🙂
-Nyxx
Thanks, Dean
It worked for me too.
The difference I’ve seen with your instructions is the version of Red5 you use. This HowTo says …/trunk.
With my first installation I used the …/tags/0_8_0/red5 because I heard it was recommended instead of the latest trunk, but that one didn’t work for me.
So, the …/tags/0_9_0/red5 is the one. I’m on Centos5.3.
The next step is to review the init script you posted, cause it doesn’t work in my server.
Thanks for your instructions.
Regards.
neme
@ Nyxx – thank you for pointing that out. I did forget to say that in some cases you need to change the permissions of red.sh
I will add that, and correct some typos too. Sorry, I typed it up in a rush.
Just be careful with the compatibility of your applications. If you install an app in to webapps and its not compatible, again, you will be stuck as the bootstrap message. If this happens, remove that app.
Remember to always restart red5 when adding an app.
@Meme –
Yes you are correct. The instructions use a never version of ant and red5.
You can choose to use an older version of red5 if you wish however you might encounter problems if you use a version below 0.8.0.
The script should work fine on 5.3. That said I only have 5.4 to test on though. If you using putty, it can some times cut off the top of the copy when copying and pasting. You might want to double check that this is not happening.
i followed all the steps.Everything worked fine exepct
cp -r dist/conf .
when executed the command. no file or directory found
======================
root@nod1 [/usr/local/red5]# /etc/init.d/red5 start
Starting red5: [ OK ]
====================================
root@nod1 [/usr/local/red5]# /etc/init.d/red5 status
red5 dead but pid file exists
=================================
root@nod1 [/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: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.
=============================
can you figure out the problem why is it saying red5 dead but pid file exists
when yu executed cp -r command, make sure that you are in the correct dir, what is the outcome of ‘pwd’ command ?
Hi — I have been able to successfully install red5 on my centOS 5.5 server with your instructions but when I go to http://[IP]:5080/installer I receive the following error:
Net status: NetConnection.Connect.Failed
Trying to connect to war location
Net status: NetConnection.Connect.Failed
Trying to connect to war location
Any ideas as to what might be wrong?
Thanks!
i execute command in
cp -r dist/conf
in
cd /usr/local/red5
=============
[root@aswik red5]# cp -r dist/conf .
cp: cannot stat `dist/conf’: No such file or directory
==============
pwd commad:
[root@aswik ~]# pwd
/root
@Af,
Im guessing your server is remote. If it is and you are using WHM, Plesk or another control panel, you must edit your IPtables to allow connections from red5 ports.
Port 1935 and 5080 must be allowed. If you do not have access to this then you must ask your hosting provider.
If your server is next to you, just allow thoses ports in your firewall.
@Waqas,
did you perform each of these seperatly?
ant prepare
then
ant dist
then
cp -r dist/conf .
if so, did you get a message saying the red5 install was successful?
@Dean
I think this is the error
[root@aswik red5]# ant dist
====================
BUILD FAILED
/usr/local/red5/build.xml:214: The following error occurred while executing this line:
/usr/local/red5/build.xml:235: Error running /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac compiler
Total time: 1 minute 14 seconds
==============================
command was successfully executed
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel
Worked like a charm
Thanks
@Waqas,
What version of Centos are you using, im guessing 5.5?
If 5.5 the there could be a problem between java and ant.
you might need to use newer version of java.
Hi Dean!
First of all thanks for these infos here, it was more then helpful!
I’m running red5 on a remote server, from putty terminal. My problem is that i haven’t got permission to modify the /etc/init.d/red5 file. I installed my red5 in my home folder…still running. The only thing wrong is that, if i close the putty, red5 stops as well.
So how can i close the terminal without ending the processes, i started with it?
thx in regards!
sorry, i found the solution, mb if somebody needs this i write it here:
nohup ./red5.sh
<—after you close your terminal, the process continues to run…
anyway i got another problem:
Basically i just want my site to be able, to save to file, what you record with your web-camere. So i decided, to work with the simple-recorder demo.
On my localhost testserver it worked as charm, and saved the records to .flv
Strangely on my site its not saving the files…any tipps?
Sonds to me that if you do not have permissions to edit the file then you most likely do not have write permissions in the directory you are having your files saved to.
Can you SSH to your remote? eg use FlashFXP and log in using SSH? if so, see if you can edit the permissions. If not then ask your host if thye can do it for you.
This is Scott again… I’m also getting this responce:
root@cloud1 [~]# /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: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.
root@cloud1 [~]#
Hello Dean,
I followed your guide as posted on the link here, I am on Cent os 5.5 64bit server dedicated server. I get to the last stage
/etc/init.d/red5 restart
Then I get this error?
[root@localhost red5]# /etc/init.d/red5 restart
/etc/init.d/red5: line 1: nit: command not found
/etc/init.d/red5: line 1: nit: command not found
Shutting down Red5 /etc/init.d/red5: line 1: nit: command not found
Thanks,
Leo
Leo, I believe you are copying and pasting the init script. If you want this to run smoothless then download it, rather then copy and paste. Download it by the following commamnd:
wget http://www.sohailriaz.com/downloads/red5.txt
once download is complete, rename red5.txt to simply red5 and it will work smoothly.
Regards
Aun
Hello Aun,
Thanks for the reply. I am new to Linux. so I am in the red5 fodler in putty, I did the WGEt command you mentioned, so how shall I rename it so it is now listed in /etc/init.d/red5
thanks,
Leo
@Leo
The command to rename a file is mv
Type the following as a superuser:
cd /etc/init.d/
mv red5.txt red5
–
Leo,
You will need to be in /etc/init.d directory. neme has mentioned it. Just for yur ease here are full steps:
cd /etc/init.d
wget wget http://www.sohailriaz.com/downloads/red5.txt
mv red5.txt red5
chmod 755 red5
service red5 restart
Regards
Aun
Hello Aun,
Thanks for this. How can I open the two ports needed for red5 server on Cent os 5.5 64bit I am using SSH via command line in Putty?
Also my other question, how do I upload my own videos into the directory for red5 so I can then set video as rtmp on my pages?
Thanks,
Leo
@Leo,
If you are running a control panel such a WHM, Plesk or Webadmin,
You open the ports using your control panel. Makes it much easier.
This is would be located under IPTables
If you do not have a control panel (which would be strange) you can edit iptables by editing the iptables configuration file as so..
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: in my previous post… the lines you add are 2 separate lines and not 4. eg the line starts with “-A” and ends with “ACCEPT”
The lines have been wrapped in this that post.
Hello Dean,
I am using Plesk, I logged into SSH as I cant see any way to control the Firewall in the Plesk control panel.
I used the VI in SSh and added the two lines, then restarted but I get this error in SSH after I try to restart the IP tables.
[root@server ~]# /etc/init.d/iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: raw nat mangle filter [ OK ]
Applying iptables firewall rules: iptables-restore: line 1 failed
[FAILED]
Thanks again,
Leo
Hi Dean
Followed your instructions to the T, However when I run ./red5.sh I get lots of text then it hangs on ‘Bootstrap complete’, I do not see ‘Installer service created’..
every step went as stated, IE BUILD SUCCESSFUL…
I am running
CentOS release 4.4 (Final)
Linux ip-***-***-***-***.ip.secureserver.net 2.6.9-42.0.3.EL #1 Fri Oct 6 05:59:54 CDT 2006 i686 i686 i386 GNU/Linux
@ Steve,
These instructions will only work on Centos 5+ and no lower versions. There would be incompatibility issues wiht version 4.4
@ Leo,
The option for the firewall in Plesk is under System > Modules > Firewall
The only way this would not be availalbe is if you are logging in as a client and not an administrator.
To save writing a super long post here, take a look here
http://wiki.centos.org/HowTos/Network/IPTables
This should help you configure iptables.
Hello Dean,
I tried to open the ports, on the Plesk as well, also disabled the seLinux in the root and set level to disable, as well as turning off the firewall in Linux.
I navigate to the http://ip:5080 but it is just blank, so maybe it’s to do with the error below.
I am getting this error also, I am on Cent os 64bit, 5.5 I am following the instructions http://www.bunchcuntfridays.com/red5/Red5.txt
I am also getting the bootstrap error when I run the sh installer. It does not complete and say server installed success.
Thanks,
Leo
Hello Dean,
I opened these ports but it is still not working. I am on Cent os 5.5 64bit. I am also getting the Bootstrap Complete when i run the .sh file as well.
I tried ctrl+c on my keyboard into Putty, and followed the rest of the steps. What would cause this Bootstrap issue?
Maybe this is why it’s not working as something has not installed or failed?
@Leo,
I did mention this before but it may have been over looked.
If you have installed apps in to your webapp folder after the initial install of red5, the webapp might not be compatible with the version of red5 you are using. Try deleting the webapp and restarting red5.
If there are no apps, then to be honest, I am just as stuck as you. I am no linux genius and learning just as the rest of the people here. I just play with it as much as I can to learn.
Just a though, you did install the 64 bit of java didnt you?
You can try this;
svn co http://red5.googlecode.com/svn/java/server/tags/0_9_1 red5-0.9.1
cd red5-0.9.1
ant prepare
ant dist
@waqass
On Centos 5.5
try this:
export _JAVA_OPTIONS=”-Xms32m -Xmx128m”
ant prepare
ant dist