Sunday, August 1, 2010

Installing Red5 on Ubuntu 9.04 32 bit

Installing Red5 on Ubuntu 9.04

Assuming you do not know what ant,svn,Red5 are and you have just installed Ubuntu 9.04 on your desktop.


Now you are wondering where in the world you should be doing all these things.
If you are trying this blog and some thing does not works for you drop me a mail so that I can understand what you missed and try to help you.

Before we begin
If you are a complete newcomer then read

you need to know what is
1)ant
2)svn
3) how to set class paths in Linux

Let us begin with creating an environment to be able to install Red5.
Red5 is based on Java.
So you need to have Java installed in your computer.
If you do not have

then Start here otherwise you can jump to Step 14

Install JAVA for Red5

Step1) Check
/etc/apt/sources.list
and enable or add following lines if you do not have already note the partner word at the end

deb http://archive.canonical.com/ubuntu jaunty partner
deb-src http://archive.canonical.com/ubuntu jaunty partner


Step2) Do an apt-get update
and type
apt-get install sun-jdk6-java

it should work
if you have any problems
I will strongly recommend to check following links (I faced problems which got solution on these links)
http://zebardast.ir/en/installing-sun-jdk-5-on-ubuntu-9-10-and-10-04/
http://www.linuxquestions.org/questions/linux-software-2/java1-5-installation-error-ubuntu-10-04-server-edition-uname-2-6-32-23-server-817569/

Please do not install jre for Red5 as Red5 needs jdk and not jre as you will read below in this post.

Step 3) Now go to /etc/profile.d/ and create a file named jdk.sh

export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$JAVA_HOME/bin:$PATH


Install ant

I will strongly recommend to install latest ant binary from apache website do not use old versions I had some errrors which actually were resolved when I used the latest ones
Step 4) Download http://ant.apache.org/bindownload.cgi the latest binary for your Linux
if by the time of reading this blog it is one year or more and you by chance have come across and the above link does not works do Google apache ant binary download
I will suggest Google ant apache download and use the latest version because in my case I got this problem from some blog old links were not working

It is a good practise to install these type of packages in
/usr/lib/
(although not necessary)
so you should have some thing like

/usr/lib/apache-ant-1.8.1

Step 5) go back to /etc/profile.d and create
/etc/profile.d/ant.sh and its content will be

export ANT_HOME=/usr/lib/apache-ant-1.8.1
export PATH=$ANT_HOME/bin:$PATH

Step6) I installed in /usr/lib both Jdk and Ant so my JAVA_HOME and ANT_HOME are like that.

upto this step do a check
echo $JAVA_HOME
you should get
/usr/lib/jvm/java-6-sun
and

root@tapas-laptop:/etc/apt# echo $ANT_HOME
/usr/lib/apache-ant-1.8.1

Step 7) If you do not get upto the above mentioned steps 6 then do not proceed further first resolve the above issues.
Here are a few links which I feel will be useful to you since I had problems from Step1 to Step6 which got resolved
following links you can read
http://ubuntuforums.org/showthread.php?t=1543461
http://ubuntuforums.org/showthread.php?t=1543461


Step 8) Assuming that if you type which java and which ant on command prompt you are getting following output
root@tapas-laptop:/etc/apt# which java
/usr/lib/jvm/java-6-sun/bin/java


root@tapas-laptop:/etc/apt# which ant
/usr/lib/apache-ant-1.8.1/bin/ant



Step 9) Check ant -version

you should get an output like this

root@tapas-laptop:/etc/apt# ant -version
Apache Ant version 1.8.1 compiled on April 30 2010

Step 10) check java -version

root@tapas-laptop:/etc/apt# java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)


Step 11) If upto above you have got exactly what mentioned only then proceed further.
Otherwise resolve the above errors first.

If you get an error like
Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/java-6-sun/bin/bin/java

check this thread

http://ubuntuforums.org/showthread.php?t=1543461

or if you get an error like

ant

Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-sun-1.6.0.13/lib/tools.jar
Buildfile: build.xml does not exist!
Build failed

check this thread
http://ubuntuforums.org/showthread.php?t=1543461

Step 12) Install subversion
apt-get install subversion

you do not need to know what subversion is to be able to use it although it will help if you know it
When I used I did not knew what it is.

Step13) Now go to http://code.google.com/p/red5/
http://code.google.com/p/red5/source/checkout
since they can move the repositories if you hit this blog at a later date and then do Google svn red5 trunk

Step 14)
Go to /opt (not necessary to be in opt but I prefer)
type following command
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5-read-only

after some minutes depending upon your internet connection you will see a directory named

red5-read-only in /opt or where ever you executed this command say for example you executed
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5-read-only
from your home directory i.e.
/home/user
then you will see
/home/user/red5-read-only

Rename red5-read-only to red5
If you do not know how to rename do following from your
directory where you executed svn command

mv red5-read-only red5

Step 15) now go to /opt/red5 and type
cd /opt/red5
and type
ant

please note if you get an error like this

Buildfile: /opt/red5/build.xml
BUILD FAILED
Target "build" does not exist in the project "Red5".

then you do not need to type ant build for building any thing
just type ant from /opt/red5 and the above error should go I got this information here
http://old.nabble.com/Red5-Linux-installation-problem-td17522740.html
if this does not solves your problem you should Google the error message


Step 16) Thats it.

Now go to /opt/red5/dist and you should see red5.sh
on command prompt ./red5.sh should give you some output do not close the terminal and check in
browser http://localhost:5080/


I have not explained how to create a startup script for this but if you want to read check the following blog
http://www.sherin.co.in/red5-flash-media-server-development-how-to-install-and-configure/
I will post it and give a link to my blog also.
Just want your confusion to be less :)

9 comments:

satya said...

Everything ran fine except the last step
(although I had to setup proxy(authentication) for svn and I had to download all the dependency files manually as my proxy did not allowed to download files by the ivy resolver)

I have checked all the places where you have put checkpoints.

But when I run ./red5.sh, I can't see any process running with port 5080, as u can see the output of netstat below.


satya@satya-bbb:~$ netstat -ntlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp6 0 0 :::45482 :::* LISTEN 6127/java
tcp6 0 0 :::1935 :::* LISTEN 6127/java
tcp6 0 0 :::9999 :::* LISTEN 6127/java
tcp6 0 0 ::1:631 :::* LISTEN -
satya@satya-bbb:~$


I am fade off with proxy now, still I don't have any other way around.

Can you please point out where I am going wrong.

Satya

anoopL said...

Hi,

I face the same issue that Satya has.
I am using Ubuntu 10.04 on Amazon EC2.

I have only this ports listening 9999 and 56240. That too on IPV6/TCP6.

Same time everything is working fine with the binary download.

Please support.

satya said...

hi anoopL, plz refer the following link to know what is the exact problem and how to solve that
http://groups.google.com/group/red5interest/browse_thread/thread/7221d266a6946bf8#

Aaron Winborn said...

I'm stuck attempting to install jdk. I've ensured that /etc/apt/sources.list has the two archive db urls uncommented, but am getting the following. Any ideas?

$ sudo apt-get install sun-jdk6-java
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package sun-jdk6-java

Aaron Winborn said...

or rather deb:

deb http://archive.canonical.com/ubuntu jaunty partner
deb-src http://archive.canonical.com/ubuntu jaunty partner

Aaron Winborn said...

in fact,

http://packages.ubuntu.com/search?suite=all&searchon=names&keywords=sun-jdk6-java

shows no results. is that the correct package?

thanks

Aaron Winborn said...

maybe it's supposed to be sun-java6-jdk. i get the following (which is closer, but still no dice):

$ sudo apt-get install sun-java6-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package sun-java6-jdk has no installation candidate

Aaron Winborn said...

solved that part:

deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse

then because of a conflict:

sudo apt-get remove sun-java6-bin

and finally:

sudo apt-get install sun-java6-jdk

Tapas said...

You will get java packages from Ubuntu partner repositories i.e.

your /etc/apt/sources.lst should have following

deb http://archive.canonical.com/ubuntu jaunty partner
deb-src http://archive.canonical.com/ubuntu jaunty partner

replace jaunty by what ever your distribution code name is