Search Posts on Binpipe Blog

Red5 Media Server Installation on CentOS 6


Red5 Media Server is a powerful media streaming server. I am still probing the possibilities of using this server and RTMP in various applications. You can follow these steps to install it on your own server and test it out.
Step 1: Installing  Java

You may skip this steps if you have already installed java on your system else use below link to install latest java version.

Step A: Download Archive File

Download java fromhttp://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.

# cd /opt/  # wget http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-i586.tar.gz?AuthParam=1372657186_d532b6d28fdb7f35ec7150a1d6df6778  

Extract downloaded archive using following command.

# tar xzf jdk-7u25-linux-i586.tar.gz  
Step B: Install JAVA using Alternatives

After extracting java archive file, we just need to setup to use newer version of java using alternatives. Use the following commands to do it.

# cd /opt/jdk1.7.0_25  # alternatives --install /usr/bin/java java /opt/jdk1.7.0_25/bin/java 2  # alternatives --config java    There is 1 program that provides 'java'.      Selection    Command  -----------------------------------------------  *+ 1           /opt/jdk1.7.0_25/bin/java    Enter to keep the current selection[+], or type selection number: 1  

Now you have successfully configured java in your system. Go to next step to check current installed version.

Step C: Check Version of JAVA .

Use following command to check which version of java is currently being used by system.

# java -version  
java version "1.7.0_25"  Java(TM) SE Runtime Environment (build 1.7.0_25-b15)  Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode)  
Step D: Setup Environment Variables

Most of java based application’s uses environment variables to work. Use following commands to setup it.

  • Setup JAVA_HOME Variable
  • # export JAVA_HOME=/opt/jdk1.7.0_25  
  • Setup JRE_HOME Variable
  • # export JRE_HOME=/opt/jdk1.7.0_25/jre  
  • Setup PATH Variable
  • # export PATH=$PATH:/opt/jdk1.7.0_25/bin:/opt/jdk1.7.0_25/jre/bin

Step 2: Install the Apache Ant Binary

Apache ant is a tool similar to make. It is implemented using the java language. It is used for automating software build processes and is best suited to building Java projects. Download the latest apache ant archive and install it.

# cd /opt/  # wget http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.0-bin.tar.gz  # tar xzf apache-ant-1.9.0-bin.tar.gz  # mv apache-ant-1.9.0 /usr/local/apache-ant
Step 3: Setup Environment Variables

Its necessory to set environment variables to make it working.

# echo 'export ANT_HOME=/usr/local/apache-ant' >> /etc/bashrc  # echo 'export JAVA_HOME=/opt/jdk1.7.0_25' >> /etc/bashrc  # echo 'export PATH=$PATH:/usr/local/apache-ant/bin' >> /etc/bashrc  # echo 'export CLASSPATH=.:$JAVA_HOME/lib/classes.zip' >> /etc/bashrc    # source /etc/bashrc
Step 4: Checkout Red5 using Subversion

Red5 source code is available under subversion repository also. So its easier to download code using subversion.

# cd /usr/local/  # svn co http://red5.googlecode.com/svn/java/server/tags/1_0/  red5
Step 5: Build Red5 using Ant

After finishing downloading code, lets build Red5 using ant libraries using following commands.

# cd /usr/local/red5  # ant prepare  # ant dist
Step 6: Start Red5 Media Server

Red5 media server uses 5080 tcp port for provide web interface.

# cd /usr/local/red5/dist  # ./red5.sh &
Step 7: Access Red5 Media Server

Red5 demo pages and application can be accessed at http://servername_or_IP:5080/

URL:   http://192.168.x.y:5080


Nmap Command Usage in Linux Server

If you don't have NMAP yet in your server, use this link to get it installed in your server. The following Nmap commands always come handy, so check them out:

Scan For Unused IP Address

# nmap -T4 -sP 192.168.0.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp

 

Get Info About Remote Host Ports And OS Detection

# nmap -sS -P0 -sV -O targetIP

 

Get List of Servers With A Specific Port Open

# nmap -sT -p 80 -oG - 192.168.0.* | grep open

Change the -p argument for the port number.

Scan Network for Rogue APs

# nmap -A -p1-85,113,443,8080-8100 -T4 --min-hostgroup 50 --max-rtt-timeout 2000 --initial-rtt-timeout 300 --max-retries 3 --host-timeout 20m --max-scan-delay 1000 -oA wapscan 10.0.0.0/8

 

Find All Active IP Addresses In A Network

# nmap -sP 192.168.0.*

 

Use A Decoy IP While Scanning Ports

# sudo nmap -sS targetIP -D fakeIP

 

How Many Linux And Windows Devices Are On Your Network?

# sudo nmap -F -O 192.168.0.1-255 | grep "Running: " > /tmp/os; echo "$(cat /tmp/os | grep Linux | wc -l) Linux device(s)"; echo "$(cat /tmp/os | grep Windows | wc -l) Window(s) devices"  

 

UDP Scanning

# sudo nmap -sU -P0 -T Aggressive -F targetIP


Disable unwanted services in CentOS

You can use the following shell script in centos to disable inwanted services which may consume RAM. Please make sure you check which services you need to disable according to your requirement. My list of services in the below script is just indicative.

#!/bin/bash -x

# Disable unwanted services in Linux


services="rpcbind portreserve qpidd kdump abrt-ccpp abrt-oops abrtd ktune matahari-broker matahari-host matahari-network matahari-rpc matahari-service matahari-sysconfig quota_nld rngd tuned ntpdate iscsi iscsid tcsd saslauthd rawdevices isdn dnsmasq capi avahi-dnsconfd avahi-daemon NetworkManager NetworkManagerDispatcher acpid anacron apmd atd auditd autofs bluetooth conman cups cpuspeed dhcdbd dund firstboot gpm haldaemon messagebus mdmonitor mdmpd netplugd restorecond hidd ibmasm ip6tables irda irqbalance kudzu lvm2-monitor mcstrans microcode_ctl multipathd netconsole netfs nfs nfslock nscd oddjobd pand pcscd portmap psacct rdisc readahead_early readahead_later rpcgssd rpcsvcgssd rpcidmapd sendmail smartd wpa_supplicant ypbind yum-updatesd"


for service in $services; do

  /sbin/chkconfig --del $service

done

Take mysqldump without increasing server load

If you have a very high traffic website and you need to take the dump
the database without affecting the load of the sever then use the
following code snippet:

# mysqldump -u root -p --single-transaction --quick DATABASENAME > DATABASENAME.sql