SEGUIDORES

Installing Red5 on cPanel/WHM CentOS and RedHat Linux servers

Installing Red5 on cPanel/WHM CentOS and RedHat Linux servers
Install Red5 on cPanel

This second description is more detailed than the previous one and I tried to include the useful tips we got from users (thanks!). I am also including the result of our 75 days experience with Red5 and running JabberCam on Red5. The description and tips are not bulletproof, however it was proven to work on all cPanel (CentOS Linux) servers since now. We did install it on five servers, we also got positive feedback form several CRC customers and hosting companies.

Follow the instructions and Red5 will work on most Linux CentOS servers (most cPanel/WHM, VPS or dedicated). Again, if you have a shared hosting account, please contact your server administrator to install Red5!
*to run the commands below, an FTP account is not enough! You will need Shell (SSH) access and a client for connecting ( ex. PuTTy http://www.putty.org ).

Connecting via SSH:
Download PuTTy from http://www.putty.org, install and start the program than enter your server details:
Host Name (or IP address): root@YOURSERVERIPADDRESS or username@YOURSERVERIPADDRESS
Port: 22 by default or ask your server admin
*ask SSH root access from your hosting administrator

When you are connected, follow these instructions (type in the commands inside the quotes - one command per line):

INSTALL JAVA
Quote:yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

INSTALL ANT
Quote:cd /root/tmp
wget http://mirrors.kahuki.com/apache/ant/bin...in.tar.bz2
tar jxvf apache-ant-1.8.1-bin.tar.bz2
mv apache-ant-1.8.1 /usr/local/ant
*the link is: mirrors.kahuki.com/apache/ant/binaries/apache-ant-1.8.1-bin.tar.bz2 (http://mirrors.kahuki.com/apache/ant/binaries/)

EXPORT VARIABLES FOR ANT AND JAVA
Quote:export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

echo 'export ANT_HOME=/usr/local/ant' >> /etc/bashrc
echo 'export JAVA_HOME=/usr/lib/jvm/java' >> /etc/bashrc
echo 'export PATH=$PATH:/usr/local/ant/bin' >> /etc/bashrc
echo 'export CLASSPATH=.:$JAVA_HOME/lib/classes.zip' >> /etc/bashrc

INSTALL SVN
Quote:yum install perl-URI

yum install subversion

* if you got the error: 
Install Error: Missing Dependency: perl(URI) >= 1.17 ...
Quote:wget http://yum.trixbox.org/centos/5/RPMS/per...noarch.rpm
rpm -i perl-URI-1.35-3.noarch.rpm

yum install subversion
*the link is: yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm

INSTALL RED5
Quote:svn co http://red5.googlecode.com/svn/java/server/tags/0_8_0/ red5
mv red5 /usr/local/
cd /usr/local/red5

ant prepare
ant dist
cp -r dist/conf .
*Red5 0.8 is recommended instead of latest trunk, as shown above

START RED5
Quote:./red5.sh &

CREATE INIT FILE
Quote:vi /etc/init.d/red5
paste the script below than save and close by pressing ESC than typing :wq

Code:
Quote:#!/bin/sh
# Startup script for Red5 flash streaming server on RedHat/CentOS (cPanel)
# chkconfig: 2345 95 55
# description: Red5 Flash Streaming Server
# processname: red5

PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid

# Source function library
. /etc/rc.d/init.d/functions

[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5

RETVAL=0

case "$1" in
start)
echo -n $"Starting $PROG: "
cd $RED5_HOME
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG

fi
[ $RETVAL -eq 0 ] && success $"$PROG startup" || failure $"$PROG startup"
echo
;;
stop)
echo -n $"Shutting down $PROG: "
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac

exit $RETVAL

Make it executable and execute:
Quote:chmod a+x /etc/init.d/red5
/etc/init.d/red5 restart

You are done, check if Red5 is running by accessing http://YOUR_SERVER_IP:5080

ACCESSING RED5 ADMIN
http://YOUR_SERVER_IP:5080/installer/ (install admin)
http://YOUR_SERVER_IP:5080/admin/register.html (add user/pass)
http://YOUR_SERVER_IP:5080/admin/

TROUBLESHOOTING
testing ports: http://YOUR_SERVER_IP:5080/demos/port_tester.html
*when testing ports, use server IP not localhost, make these ports accept connections: 1935, 1936, 5080, 8088

Quote:netstat -nap
OR
nmap fuser localhost
*on a default cPanel install these ports should be allowed, if not (please ask your server admin) try turning off the firewall for a short time:
WHM -> ConfigServer Security&Firewall -> [Firewall Disable]
If this solves the problem, you must configure csf to accept connections on these ports ( http://www.configserver.com/cp/csf.html ).

Idea CONNECTING TO MySQL
JabberCam, CRC3 and other video chat software are using MySQL database for user related operations. To use these features, you will need to connect your server-side application to your MySQL database and it may give you a hard time. This is how we succeeded on every server:

tomcat-dbcp.jar – only needed if the next error occurs:
Quote:javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
*if the above error occurs, download tomcat-dbcp.jar (http://www.java2s.com/Code/Jar/STUVWXYZ/...pjar.htm), extract the archive, place tomcat-dbcp.jar in your /lib folder and restart red5
*you may place the file in your /usr/local/red5/webapps/ChatrouletteApp/WEB-INF/lib folder or /usr/local/red5/lib folder, just make sure you don't have it in both folders!

mysql-connector-java-5.1.12-bin.jar missing
if you are unable to connect to backend services, it means that the MySQL driver is missing, download it (http://dev.mysql.com/downloads/connector/j/) and place it in your /lib folder than restart red5
*you may place the file in your /usr/local/red5/webapps/ChatrouletteApp/WEB-INF/lib folder or /usr/local/red5/lib folder, just make sure you don't have it in both folders!

commons-dbcp-1.4.jar missing
if you are unable to start your Red5 application (or it doesn't even show up in admin), download commons-dbcp-1.4.jar (http://commons.apache.org/dbcp/download_dbcp.cgi)extract the archive and place commons-dbcp-1.4.jar in your /lib folder and restart red5
*you may place the file in your /usr/local/red5/webapps/ChatrouletteApp/WEB-INF/lib folder or /usr/local/red5/lib folder, just make sure you don't have it in both folders!

Idea If still nothing, check your config file /etc/my.cnf
Quote:vi /etc/my.cnf
*delete this line: skip-networking than save and quit vi (press ESC than type :wq) and restart MySQL:
Quote:/etc/init.d/mysql restart




Idea Red5 ADMIN NOT FOUND Red5 0.9
NOTE: We and numerous other clients/web hosts tried to run JabberCam, CRC 3 and other video software on Red5 0.9 without success, we recommend using Red5 0.8 for the moment.

After installing Red5 0.9 and trying to access SERVER_IP:5080/admin/ you will (may) encounter the following error:
Quote:HTTP Status 404 - /admin
type Status report
message /admin
description The requested resource (/admin) is not available.
Apache Tomcat/6.0.26
no problem, the admin panel was moved here: SERVER_IP:5080/demos/adminPanel.html

When logging in, use the server IP for "Server Address" and the user "admin" with the password "admin".

If that does not work, you must register an admin user, just follow the instructions below:[/b]
*assuming that your Red5 installation path is /usr/local/red5 if it is different (ex. /opt/red5 or /opt/red5/dist/) just change those values in the following commands

Get the plugins:
Quote:cd /root/tmp
mkdir /usr/local/red5/plugins
wget http://red5.googlecode.com/files/AdminPlugin-1.0.zip
unzip -d /usr/local/red5/plugins AdminPlugin-1.0.zip
Get the Red5 admin register page:
Quote:mkdir /usr/local/red5/webapps/admin
wget http://red5.googlecode.com/files/admin.jsp
mv admin.jsp /usr/local/red5/webapps/admin
*restart Red5 (/etc/init.d/red5 restart)

Access Register Admin page: YOUR_IP:5080/admin/admin.jsp and register your admin user and password.

Finally go back to SERVER_IP:5080/demos/adminPanel.html and log in using the user and password you just registered (and your server IP).


Idea RED5 LARGE LOG FILE
/usr/local/red5/log/red5.log is getting too big

Solution: add an appender to /usr/local/red5/conf/logback.xml (MaxHistory 11 days and MaxFileSize 100MB here. You may change it)

Quote:<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/red5.log</File>
<Append>false</Append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>log/red5.%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>11</MaxHistory>
</rollingPolicy>
<Encoding>UTF-8</Encoding>
<BufferedIO>false</BufferedIO>
<ImmediateFlush>true</ImmediateFlush>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{ISO8601} [%thread] %-5level %logger{35} - %msg%n</Pattern>
</layout>
<triggeringPolicy>
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>

You can also separate Red5 logs using a Threshold Filter:
Quote:<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/red5errors.log</File>
<Append>false</Append>
<filter>
<level>WARN</level>
</filter>
...
</appender>
Baixe o Flash Player para executar...