Live Video, Web2.0, Rich Media, Custom Content
Posts tagged shell
Install Red5 on SUSE Linux
Apr 3rd
First know your system to know what to install.
Use uname -a to see if you need to download 32 or 64 bits versions.
Get SUSE release: cat /etc/SuSE-release
INSTALL JDK
Install latest JDK from http://java.sun.com/javase/downloads/index.jsp .
Use chmod a+x to make downloaded file executable and execute it.
Make sure latest version is used:
ln -s /usr/java/latest /usr/local/jdk
ln -s /usr/java/latest/jre /usr/local/jre
rm /usr/bin/java
ln -s /usr/java/latest/bin/java /usr/bin/java
export JAVA_HOME=/usr/java/latest/
INSTALL SVN
Get SVN from: http://software.opensuse.org/search?baseproject=ALL&p=1&q=subversion
Install RPMs with: rpm -iv package.rpm
Install any dependencies as required. Search from http://software.opensuse.org/search .
INSTALL ANT
wget http://www.apache.org/dist/ant/binaries/apache-ant-1.8.0-bin.tar.gz
tar zxvf apache-ant-1.8.0-bin.tar.gz
mv apache-ant-1.8.0 /usr/local/ant
Configure
export ANT_HOME=/usr/local/ant
ln -s /usr/local/ant/bin/ant /usr/local/bin/ant
Replace old ant
rm /usr/bin/ant
ln -s /usr/local/ant/bin/ant /usr/bin/ant
Check ant version:
ant –version
INSTALL Red5
Get latest Red5 :
svn co http://red5.googlecode.com/svn/java/server/trunk red5
Build Red5 :
cd red5
ant prepare
ant dist
Move Red5:
cd ..
mv red5 /opt/red5
OPERATE RED5
Start Red5 (when need or on server reboot):
cd /opt/red5/dist
./red5.sh > start.log &
Install/update applications in the /opt/red5/dist/webapps folder . For changes to take effect, Red5 must be restarted:
1. Check if red5 is running:
ps aux | grep red5
2. Go to its folder and shut red5 down:
cd /opt/red5/dist
./red5-shutdown.sh
3. See if it’s still running or not:
ps aux | grep red5
4. Restart it, and also make it output the logs into a file of your choice:
./red5.sh > start.log &
5. Make sure it’s back online:
ps aux | grep red5
Install GeoIP PHP Extension
Feb 10th
Install GeoIP C API
Change 1.4.6 to downloaded version.
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar zxvf GeoIP.tar.gz
cd GeoIP-1.4.6
./configure
make
make check
make install
Install PHP PECL extension
wget http://pecl.php.net/get/geoip
tar zxvf geoip
cd geoip-1.0.7
phpize
./configure
make
make check
make install
Find php.ini
php –ini
Enable extension to load in php.ini:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
extension=geoip.so
You may need to restart HTTP server (apache) to apply changes.
Download Geo Lite City database
wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
mv GeoLiteCity.dat /usr/local/share/GeoIP/GeoIPCity.dat
For more accurate detection and production projects, buy the full GeoCity database from MaxMind.
Run Red5 & Wowza Flash Media Servers on Same Linux Server
Jan 13th
This post shows how to install Wowza on a server where there is another RTMP server, already installed, i.e. Red5. Run 2 rtmp servers at same time and allow applications to connect on both simultaneously.
Installed Red5 0.8 RC3 with JDK 1.6.13 on Linux
Apr 29th
Updated for Red5 0.9.1 Final .
Updated for JDK 1.6.20 .
Updated for ANT 1.8.1 .
Here is how we installed latest Red5 and JDK on a server with Linux CentOS . These hints can help you install on many linux VPS or Dedicated enviroments. We mainly do software development and work from windows, so we use WinSCP and PuTTy (free software). We browsed a lot of tutorials and web pages to get instructions that installed latest versions.
First, we made sure we have all prerequisites to install the rpm:
yum install rpm-build redhat-rpm-config
Allow required ports (not necessary if already opened): 3690 (svn), 5080, 1935, 1936, 8088. See more details at the end of this tutorial.
JAVA INSTALLATION
We installed latest JDK from http://java.sun.com/javase/downloads/index.jsp .
Use uname -a to see if you need to download a 64 bits version.
Went to root/tmp folder for downloads:
cd /root/tmp
We got Java SE Development Kit, JDK 6 Update 13. We selected linux multilanguage, right clicked > properties on the jdk-6u13-linux-i586-rpm.bin and downloaded it with wget url on the server. It downloaded with a big name with parameters (ls to see after download). We use WinSCP so we right clicked, refreshed from there and then renamed the new file that showed up in the root home directory.
You can also rename it from shell. Make sure you use mv “old_long_name” new_name for the long name as it uses special characters.
Make sure you install JDK and not JRE.
Made it executable and executed it:
chmod a+x jdk-6u13-linux-i586-rpm.bin
./jdk-6u13-linux-i586-rpm.bin
Press space or enter to scroll terms and when it asks you type yes and hit enter.
If needed confirm Java DB update, yes ENTER.
We installed it on multiple servers and had to change some shortcuts on ones that already had an older java, so it runs the new one. Usually if preinstalled it’s located in a java or jdk folder in /usr or /usr/local .
Make sure the shortcuts in /usr/local point to the new locations (/usr/local/jdk to /usr/java/jdk1.6.0_14 and /usr/local/jre to /usr/java/jdk1.6.0_14/jre) .
ln -s /usr/java/latest /usr/local/jdk
ln -s /usr/java/latest/jre /usr/local/jre
Also /usr/bin/java shortcut should point to /usr/java/latest (not /etc/alternatives/java):
rm /usr/bin/java
ln -s /usr/java/latest/bin/java /usr/bin/java
export JAVA_HOME=/usr/java/latest/
Make sure this is the one used if you also have older versions installed:
java –version
ANT INSTALLATION
Downloaded ant (can be done from any mirror – see http://ant.apache.org/bindownload.cgi), unpacked it, moved it to a good location and added variable, shortcut.
Get ANT
wget http://www.apache.org/dist/ant/binaries/apache-ant-1.8.1-bin.tar.gz
tar zxvf apache-ant-1.8.1-bin.tar.gz
mv apache-ant-1.8.1 /usr/local/ant
If older ANT is preferred get latest from http://archive.apache.org/dist/ant/binaries/ .
i.e. ANT 1.7.1
wget http://www.apache.org/dist/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
Configure
export ANT_HOME=/usr/local/ant
ln -s /usr/local/ant/bin/ant /usr/local/bin/ant
Replace old ant
rm /usr/bin/ant
ln -s /usr/local/ant/bin/ant /usr/bin/ant
Checked ant version:
ant –version
If this can’t find java, make sure you run export JAVA_HOME=/usr/java/latest/.
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/local/jdk/bin/java
SUBVERSION INSTALLATION
yum install subversion
If that doesn’t work maybe this can help:
Fix: Install perl uri:
wget ftp://rpmfind.net/linux/dag/redhat/el2.1/en/i386/dag/RPMS/perl-URI-1.17-1.el2.rf.noarch.rpm
rpm –i perl-URI-1.17-1.el2.rf.noarch.rpm
Fix: This time got “Error: Cannot retrieve repository metadata (repomd.xml) for repository: atrpms. Please verify its path and try again” .
Solution: yum –disablerepo=atrpms install subversion .
RED5 BUILD AND INSTALLATION
Then we downloaded Red5:
svn co http://red5.googlecode.com/svn/java/server/trunk red5
Update1: This downloads latest Red5. On this installation (update1) Red5 0.9 was downloaded.
If latest trunk has bugs or does not work fine with your required software you can download other versions from http://red5.googlecode.com/svn/java/server/tags/ .
Example:
svn co http://red5.googlecode.com/svn/java/server/tags/0_8_0/ red5
or
svn co http://red5.googlecode.com/svn/java/server/tags/0_9rc1/ red5
Built red5 :
cd red5
ant prepare
ant dist
On upgrade, copy webapps to new build.
cp -rf /opt/red5/dist/webapps/* /root/tmp/red5/dist/webapps/
Then rename old red5 (backup).
You could also remove sample applications if you don’t plan to use these:
rm -rf /opt/red5/dist/webapps/live
rm -rf /opt/red5/dist/webapps/vod
rm -rf /opt/red5/dist/webapps/installer
rm -rf /opt/red5/dist/webapps/root/demos
rm -rf /opt/red5/dist/webapps/root/WEB-INF
Moved Red5 from home folder:
cd ..
mv red5 /opt/red5
Started Red5:
cd /opt/red5/dist
./red5.sh > start.log &
The > start.log is to have it output the logs in the file and & is to keep it running in the background.
Verified that Red5 was running:
ps aux | grep red5
This should report a long line with java and many options and this command. Check start.log if it failed to start.
We added these lines to to /etc/rc.d/rc.local so it starts on each server start:
cd /opt/red5/dist
/opt/red5/dist/red5.sh > restart.log &
Make sure your run it from the right folder. The one in /opt/red5 will not work – you must run it from /opt/red5/dist/ .
When Red5 is running you should be able to access http://your-server-domain-or-ip:5080/ .
If it works first thing go to http://your-server:5080/installer/and install admin. Then to http://your-server:5080/admin/register.html and register an username and password. Then you can check application statistics anytime from http://your-server:5080/admin/ with server ip and the registered username, password.
RED 5 RESTART
Restart Red5 anytime you update files in the /opt/red5/dist/webapps folder – where all applications should be installed.
Usually these should work and should be used each time you add a new application.
1. Check if red5 is running:
ps aux | grep red5
2. Go to its folder and shut red5 down:
cd /opt/red5/dist
./red5-shutdown.sh
3. See if it’s still running or not:
ps aux | grep red5
4. Restart it, and also make it output the logs into a file of your choice:
./red5.sh > start.log &
5. Make sure it’s back online:
ps aux | grep red5
We also noticed that red-shutdown.sh sometimes does not close it down to allow restart when webapps are added or updated. This usually occurs when red5 freezes becasue it encounters errors like running out of memory. So we run ps aux | grep red5 to see process id (first number: PID) and then run kill process id if it’s still alive.
ALLOWING PORTS
On some systems root cannot bind ports above the early 1000’s so red5 must be run from another account.
Verify that Red5 is listening on port 5080 if you can’t get http://yourserver:5080/:
netstat -anp | grep 5080
If using iptables enable these ports:
iptables -A INPUT -p tcp -m tcp -—dport 3690 -j ACCEPT
iptables -A INPUT -p tcp -m tcp —-dport 5080 -j ACCEPT
iptables -A INPUT -p tcp -m tcp -—dport 1935 -j ACCEPT
iptables -A INPUT -p tcp -m tcp —-dport 1936 -j ACCEPT
iptables -A INPUT -p tcp -m tcp -—dport 8088 -j ACCEPT
Sometimes ports need to be configured in a hardware firewall. Contact server provider / administrator for more details about enabling ports.
This info provided by a host could also be helpful.
Please be advised that custom iptables rules should be placed in the directory listed below.
/etc/sysconfig/iptables-customThe software firewall rule is listed as follows:
# cat /etc/sysconfig/iptables-custom/99Red5 *filter-A INPUT -p tcp -m tcp –dport 1935 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 1936 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 5080 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 8088 -j ACCEPTCOMMIT
RED5 & VIDEOWHISPER
This was done for the installation of VideoWhisper applications. To do that just download the latest videowhisper rtmp application, unzip it on your computer and copy the videowhisper folder and all its contents to/opt/red5/dist/webapps . As verification, check that you have a /opt/red5/dist/webapps/videowhisper/WEB-INF/ folder on your server. After copying/updating this, restart the Red5 server (as explained above) and you can install the videowhisper video conferencing / live streaming scrips to use the new rtmp application.
The Red5 VideoWhisper RTMP Application has some cool settings, like enabling access with external players / archiving of all video streams as flv files / limiting access to certain domains / setting absolute paths for live streams and recordings to be able to share videos with other applications (i.e. video sharing). Edit all these in WEB-INF/red5-web.properties and restart the Red5 server.
If we forgot to mention something here, or you have any questions about this submit your inquiries on Video Whisper Contact Page or comment below.
An alternative to doing the red5 installation yourself would be to order red5 installation .
If you don’t have the time and experience to run your own server or vps, you should use managed red5 hosting .
Video Conference
Video Broadcast


