How to install Red5 on Cent Os 5.4
Red5 is open source flash server written in java supports streaming audio/video, recording client streams, shared objects, live stream publishing etc. Here I will describe in details how you can install Red5 on your CentOS. For this you will also need to install Java and Apache Ant.
Step 1. 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
Step 2. Install Ant
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://opensource.become.com/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz
tar zxvf apache-ant-1.7.1-bin.tar.gz
mv apache-ant-1.7.1/ /usr/local/ant
Step 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
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
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
echo ‘export CLASSPATH=.:$JAVA_HOME/lib/classes.zip’ >> /etc/bashrc
Step 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.
Step 5. Init Script
Now we will create init script for red5 to start, stop and restart easily.
vi /etc/init.d/red5
The init script code is 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
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.
Step 6. Test
Now test the RED5 installation by opening following URL in browser
http://yourip:5080/
You will see Red5 test page.
18 Comments
Saifur on December 18th, 2009
Please recheck whether you have followed step 2 & 3 properly.
alieca on December 21st, 2009
Is it possible to install it without root access ?
Matt on December 22nd, 2009
Awesome - thanks
Had to replace some quotes ” in the init script but other that than brilliant.
Ronny on December 25th, 2009
Hi, great tutorial!
Everything went without a lot of hickups until I got to the init script. When I run it, I get the following error:
[root@centos red5]# /etc/init.d/red5 start
/etc/init.d/red5: line 43: stop: command not found
/etc/init.d/red5: line 43: restart: command not found
/etc/init.d/red5: line 43: status}”: command not found
I’m not familiar with bash/linux at all, so I can’t really figure out what I did wrong. I just copied the script you gave into the vi editos and saved it. I verified if it was saved and it is.
I had to chmod 755 it before I could run it though. But this is where i’m stuck right now.
Any piece of advice?
Thanks again, you’re really helping me out ![]()
Davor on December 28th, 2009
Same problem here:
[root@centos red5]# /etc/init.d/red5 start
/etc/init.d/red5: line 43: stop: command not found
/etc/init.d/red5: line 43: restart: command not found
/etc/init.d/red5: line 43: status}”: command not found
Please help!
camdebuck on January 13th, 2010
Problem is most likely with the case statement:
make sure it read: case \"$1\" in
(ie, case doublequote$1doublequote
I had an issue where it put a . instead of the doublequote and was causing problems when copying and pasting from the website
camdebuck on January 13th, 2010
If you have a firewall turned on, make sure you add port 5080 to your firewall (do a search for adding a port to your firewall).
If you don’t this, http://yourip:5080/ will not work.
camdebuck on January 13th, 2010
You will need to add port 1935 for RTMP
Paul Wood on February 4th, 2010
Ive gotten through everything except when I try to start the server with \"/etc/init.d/red5 start\" either permission is denied or command is not found. Also i get these -bash: commands not found when i login through ssh.
If anyone can help me that would be super sweet.
What I see in the terminal:
Last login: Wed Feb 3 23:48:15 2010 from c-24-9-203-1.hsd1.co.comcast.net
-bash: ‘export: command not found
-bash: ‘export: command not found
-bash: ‘export: command not found
-bash: ‘export: command not found
[root@BeheardCentOS2 ~]# /etc/init.d/red5 start
-bash: /etc/init.d/red5: Permission denied
[root@BeheardCentOS2 ~]# sudo /etc/init.d/red5 start
sudo: /etc/init.d/red5: command not found
TheObserver on March 4th, 2010
Hi Paul wood,
you might want to try this solutions, I google searched it for you
http://blog.mohdazam.com/lastlogin-information-bash-error
Your problem might be solved, last time a friend of mines also experiencing this problem, and use that solutions..it is worked!
Adrian on March 26th, 2010
I am getting this error when starting the server:
[root@cl-t029-292cl ~]# /etc/init.d/red5 start
-bash: /etc/init.d/red5: Permission denied
I looked at TheObserver’s solution but that doesn’t work.
Anyone can help.
Adrian on March 26th, 2010
I figured it out.
Had to change the permission of the /etc/init.d/red5 file to 755.
nithin on April 2nd, 2010
i am getting svn command not found
Shawn Hyde on April 15th, 2010
Those of you getting the errors, open:
/etc/init.d/red5
with a text editor and replace all of the quotes then, do:
/etc/init.d/red5 start
Jack on May 5th, 2010
A good RED5 installation tutorial, would like to share
http://askmeflash.com/tutorial/7/red5-installation-and-setup-how-to
Tofan on May 11th, 2010
Thanks for tutor …
I’am using CentOS 5.4
and my red5 server is running quit well
But I have big trouble to integrating php in red5 server.
I want to running live streaming php standalone version from videowhisper, but it’s not working yet.
Can you give me some guidance, to make php working on red5?
Thanks for advance

I am a simple man working in IT field. I love Music, playing soccer, traveling new places. By profession I am a software engineer and enjoy my job. Currently I am doing my M Sc in Software Engineering in Blekinge Institute of Technology, Sweden. I love researching on new technologies such as programming languages, architectures, tools and techniques.
Hey MAte
I followed the steps but when i am typing ant prepare and ant dist , its saying command not found.
Kindly help me ASAP if possible,
Regards,
Anand