Installing and Integrating Red5 with Kaltura CE5

Within this blog post we will guide you step-by-step on How to install Red5 server and integrate it with Kaltura CE.
Installing and Integrating Red5 with Kaltura CE5 can be a difficult task and I hope that after this blog your mission will be completed.

This blog post will be divided into 3 Main paragraphs.
[sspluslist]

[/sspluslist]

NOTE:The below code samples assume you are using Ubuntu.
If you are using Fedora or CentOS there will be minor changes.

Pre-requisites

First we need to install the 4 prerequisites which are: JAVA, SVN, ANT, and chkconfig.
NOTE: If you’re installing Red5 on your Kaltura machine and not on dedicated server don’t install JAVA as you probably already installed JAVA-6 and it may cause collisions with the data warehouse.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y -qq install oracle-java7-installer
sudo apt-get -y -qq install subversion
sudo apt-get -y -qq install ant
sudo apt-get -y -qq install chkconfig

After installing the above we need to set the environment variables for JAVA and ANT

export JAVA_HOME=/usr/lib/jvm/java-7-oracle/
export ANT_HOME=/usr/share/ant/
export PATH=$PATH:/usr/share/ant/bin
export CLASSPATH=/usr/share/red5/boot.jar
echo 'export ANT_HOME=/usr/share/ant' >> /etc/bashrc
echo 'export JAVA_HOME=/usr/lib/jvm/java-7-oracle' >> /etc/bashrc
echo 'export PATH=$PATH:/usr/share/ant/bin' >> /etc/bashrc
echo 'export CLASSPATH=/usr/share/red5/boot.jar' >> /etc/bashrc

Red5 Installation

First we need to download the Red5.
Go to Red5 Website download page and download Red5 version 1.0 or above.
Upload the file to your Red5 server and open it in /usr/share/red5/ directory.

mkdir /usr/share/red5
cp red5-1.0.0.tar.gz /usr/share/red5/
cd /usr/share/red5/
tar -xzvf red5-1.0.0.tar.gz

After that create a file /usr/share/red5/red5 script and copy the content from HERE to the red5 script.
This file will serve as the Red5 stop/start script so we’ll make a soft link to it to /etc/init.d/red5.
NOTE: The syntax of the red 5 script is suitable for CentOS and not for Ubuntu, if you would like to resolve the errors you get you can read more in our Red5 init Script for Ubuntu post

vim /usr/share/red5/red5
### Copy the content from http://blog.kaltura.org/wp-content/uploads/2011/12/Red5-Init-script.txt to the file ###
dos2unix /usr/share/red5/red5
chmod 744 /usr/share/red5/red5
chmod 744 /usr/share/red5/red5.sh
ln -s /usr/share/red5/red5 /etc/init.d/red5
mkdir /var/lock/subsys

Now we’ll add the Red5 to boot-up when the server is started/rebooted.

chkconfig --add red5
chkconfig red5 on

Now you can start the Red5 server.

/etc/init.d/red5 start

Kaltura CE integration

Now the last part is to integrate the Red5 with your Kaltura CE.
First we should install oflaDemo.
1. Go to your Red5 Server on port 5080.
http://Red5_Server_Ip:5080/
2. Click on “Install a ready-made application”
3. Select “oflaDemo” and click on “install”
To verify that oflaDemo is running, Go to: http://your.server.com:5080/demos/ofla_demo.html and in the server address – above the connect button – enter “rtmp://yourserver.com/oflaDemo” And click “connect”.
If the video plays well – Red5 installation complete and we can start integrating it with our Kaltura CE!

cd /usr/share/red5/webapps/oflaDemo
mv streams streams_x
mkdir  /opt/kaltura/web/content/webcam
ln -s /opt/kaltura/web/content/webcam ./streams – adding webcam and streams save location
ln -s /opt/kaltura/web/content /usr/share/red5/webapps/oflaDemo/streams

NOTE:If you are using NFS you should make the symbolic links to the NFS.
Example: ln -s /nfs/export/share/web/content/webcam /usr/share/red5/webapps/oflaDemo/streams/content

Adjust the Kaltura Contribution Wizard uiConf file:
vim /opt/kaltura/web/content/uiconf/kaltura/samplekit/kcw_2.6.4/kcw_samplekit.xml
Add the RTMP URL of your site (search for “rtmp” in the file):
change to “rtmp://yourip/oflaDemo”