Install Flash Server on Linux -- Install Red5 Server

Taking Fedora Linux as an example, there are five key steps to install:
1) Install Java 1.5JDK version or above
2) Install Apache Ant
3) Environment variable configuration
4) Install Red5 and compile
5) The system service configuration
More details as following:
1) Install Java developing environment
Download the latest JDK version of Linux from Sun official website. Here we use the version 1.5.0.11 and its downloaded file name is jdk-1_5_0_11-linux-i586.bin.
Only super user has the permission to install the software. You can input su at the terminal and then input password to switch your account to super user.
Add the executable permission to the file: chmod +x jdk-1_5_0_11-linux-i586.bin
Execute the following command to start installation:
./jdk-1_5_0_11-linux-i586.bin
According to the reference install information, it recommends the installation path: /usr/java
2) Install Apache Ant
Download the latest version Ant from the official website: http://ant.apache.org/bindownload.cgi
Unzip to the proper path, recommended unzip path: /usr/ant
3) Configuring environment variable
There are three methods:
- Modify /etc/profile file
-
Modify the .bashrc file under the user directory
-
Modify directly under shell
Since we are going to set Red5 as the system service and configure the environment variable later in the service script directly, we choose method 3 -- make modification directly under shell.
Input command directly through Terminal:
export ANT_HOME=/usr/ant
export JAVA_HOME=/usr/java
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
4) Install Red5 and compile
Download the latest version for Linux from the official website, so far it is 0.6.3
Download file name: red5-0.6.3.tar.gz
To unzip the file, it's commended to unzip to the directory of /opt/red5.
Input command to enter red5 directory: cd /opt/red5
Input command to compile: ant
5) System service configuration
Save the following script as red5 (Download the script directly), which is used to start Red5 service.
#!/bin/sh
#
# Startup script for Red5 flash streaming server
#
# chkconfig: 345 81 81
# description: RED5 by java
#
# processname: java (unfortunately)
# pidfile: /var/run/red5.pid
# config: /etc/red5.conf
# Source function library.
. /etc/rc.d/init.d/functions
PID_FILE=/var/run/red5.pid
PID=`ps ax |grep java|grep red5|awk '{print $1;}'`
RETVAL=0
start() {
echo -n $"Starting $DESCR: "
# daemon java $OPTIONS > /dev/null 2>&1 &
export ANT_HOME=/usr/ant
export JAVA_HOME=/usr/java
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
exec $JAVA_HOME/bin/java -Djava.security.manager -Djava.security.policy=/opt/red5/conf/red5.policy -cp /opt/red5/red5.jar:conf:/opt/red5/conf org.red5.server.Standalone > /dev/null 2>&1 & RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/red5 && echo $!>$PID_FILE && echo_success
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $DESCR: "
#killproc $PID_FILE
[[ $PID != "" ]] && success && kill $PID || failure
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/red5 $PID_FILE
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $"Usage: $DESCR {start|stop|restart}"
exit 1
esac
exit $RETVAL
Move the file to the path: /etc/init.d
Execute the command at Terminal as super user:
chkconfig --add red5
If it doesn't work, please make sure that the path of command chkconfig is correct. Use the following command to check:
Check the installation of chkconfig: rpm –qa|grep chkconfig
Chkconfig file path: whereis chkconfig
E.g. in Fedora Linux system, the result of performing instruction is as following:
$ rpm -qa|grep chkconfig
chkconfig-1.3.34-1
$ whereis chkconfig
chkconfig: /sbin/chkconfig /usr/share/man/man8/chkconfig.8.gz
As the above shows, the path of command chkconfig is /sbin/chkconfig, so we change the command: /sbin/chkconfig --add red5
Using the following command can make red5 start the service: /etc/init.d/red5 start
If the installation information here is not helpful enough, you may view the official site for details.
Next, you are suggested to read Install Video Chat Server RED5 Edition.
TOP
|