Friday, April 9, 2010

Howto Install RED5 Flash Media Server in Fedora 11, Centos 5.4, Redhat

Red5 is an Open Source Flash Media Server written in Java that supports:

* Streaming Audio/Video (FLV and MP3)
* Recording Client Streams (FLV only)
* Shared Objects
* Live Stream Publishing
* Remoting (AMF)

This is a reverse engineered open source project which aims to produce a feature-complete implementation written in Java. It os one of the Full implementation RTMP servers other than:

Adobe Flash Media Server,
Onlinelib VCS Video Communication Server
Wowza Media Server
WebORB Integration Server
haXeVideo

In this tutorial we'll learn howto installRED5 on Centos 5.4,Fedora, Redhat and other Linux Distribution, There are many ways to achieve this but this is how i installed RED5 Media Server on Fedora 11.

Red5 Requires Java Development Kit (JDK) to run so you have to install Java onto the system,You can acheive this in 2 ways
1. Either Use Yellow DOG Updater
# yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel


OR

Download JDK and Compile
cd /usr/java 
IF /usr/java cannot be found
mkdir /usr/java
Go to the Link and Download http://java.sun.com/javase/downloads/widget/jdk6.jsp and Download jdk-6u19-linux-i586.bin

mv /home/ashwin/Download/jdk-6u19-linux-i586.bin /usr/java/

chmod +x jdk-6u19-linux-i586.bin
./jdk-6u19-linux-i586.bin

You will see
JAVA_HOME="/usr/java/jdk1.6"
export JAVA_HOME
echo $JAVA_HOME


Great Now you have installed JAVA now proceed

Another Important requirement is ANT (It is a Apache Project) which we require to compile the RED5 Code, Good News is you dont need to compile ANT as it is already in binary format Just extract and install it in /usr/java


#cd /home/ashwin/
#w.get http://mirrors.kahuki.com/apache/ant/binaries/apache-ant-1.8.0-bin.tar.bz2
#tar -jxf apache-ant-1.8.0-bin.tar.bz2
#mv apache-ant-1.8.0 /usr/local/ant


Now we need to Export the JAVA and ANT Environment Variables which would help us in installing and proper running if RED5 Server


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


vi /etc/bashrc

# ALSO Put the Above Here
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



Now download the latest RED5 CODE from the site to build


cd /home/ashwin/
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist


You would you screen scrolling and you are not able to understand anything "CHILL" All is well and RED5 Media Server is getting compiled, AT the END you would SEE

BUILD SUCCESSFUL

If you see this you have made it you have done 95% of the work. Now copy the conf directory from dist/ and test the red5 installation.

cp -r dist/conf .
./red5.sh


STARTING, STOPPING,RESTARTING RED5 Media Server
I have created a Init Script Click Here

INIT Script to Start,STOP, RESTART RED5 Media Server

Start RED5

/etc/init.d/red5 start


TESTING RED5

Go TO your Browser Address Bar and Type

http://your.ip.address:5080

Check Out the Demos
http://your.ip.address:5080/demos/


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



Remove the from end of


Same goes for RTMPS



Remove the from end of




Restart the red5 services and connection fails problem will be fixed.

15 comments:

  1. Hi,
    Can anyone help?
    I have been going through all the steps and they are working fine.
    I did ant prepare and I got BUILD SUCCESSFUL
    but when I did ant dist I got error:
    BUILD FAILED
    /usr/local/red5/build.xml:494: Could not create task or type of type: manifestclasspath.
    Ant could not find the task or a class this task relies upon.
    Please can anyone advice me on how to fix this.
    Thanks

    ReplyDelete
  2. There is a file /etc/ant.conf which is loaded every time ant was used. That file somehow reset the ant version used to 1.6.5.

    Deleting the file or using ant with the --noconfig option solved the issue for me
    ant --noconfig -version

    # ant -version

    ReplyDelete
  3. Hi Ashwin,

    Thanks for your help it really worked but after doing vi /etc/init.d/red5 saving and changing mode. When I did /etc/init.d/red5 start

    It gave me the error:
    /etc/init.d/red5: line 47: stop: command not found
    /etc/init.d/red5: line 47: restart: command not found
    /etc/init.d/red5: line 47: status}.: command not found

    Please can u help me on this also. Thanks a lot

    ReplyDelete
  4. Hi, I am also getting the errors after creating the file at /etc/init.d/red5.

    /etc/init.d/red5: line 47: stop: command not found
    /etc/init.d/red5: line 47: restart: command not found
    /etc/init.d/red5: line 47: status}.: command not found

    Any advice?

    Thank you

    ReplyDelete
  5. I want to start blogging too, what do you think, which blog cms is good for noob?

    ReplyDelete
  6. http://pankajdangi.com/2010/01/steps-to-install-red5-on-linux/

    Some cool steps to install red5.

    Thanks
    Pankaj

    ReplyDelete
  7. Hi I can't seem to get ant to build at all i keep getting this message:
    Buildfile: build.xml does not exist!
    Build failed
    I've tried every nothing works can someone help me with this.
    I'm running Fedora Core 12

    ReplyDelete
  8. Never mind I figured it out thank you anyways

    ReplyDelete
  9. I was bored until i've found your blog, interesting posts

    ReplyDelete