Install Streaming Server (Red5) With cPanel/WHM – CentOS

http://experts-hosting.net/wp-content/uploads/2013/06/finallogored5.pnghttp://experts-hosting.net/wp-content/uploads/2013/06/finallogored5.pngInstall Streaming Server (Red5) With cPanel/WHM – CentOS

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 customers and 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 us so we can help you better!

*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@YOUR-SERVER-IP-ADDRESS or username@YOUR-SERVER-IP-ADDRESS
Port: 22 by default or ask your server admin

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

INSTALL JAVA

yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

INSTALL ANT

cd /root/tmp
wget http://mirrors.kahuki.com/apache/ant/binaries/apache-ant-1.8.3-bin.tar.bz2
tar jxvf apache-ant-1.8.3-bin.tar.bz2
mv apache-ant-1.8.3 /usr/local/ant

EXPORT VARIABLES FOR ANT AND JAVA

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

yum install perl-URI

yum install subversion

INSTALL RED5

svn co http://red5.googlecode.com/svn/java/server/tags/1_0/ red5
mv red5 /usr/local/
cd /usr/local/red5

ant prepare
ant dist
cp -r dist/conf .

START RED5

./red5.sh &

CREATE INIT FILE

nano /etc/init.d/red5

paste the script below then save and close.

or you can just download it from here : http://bit.ly/red5-on-centos

#!/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"
RETVAL=1
esac

exit $RETVAL

Make it executable and execute:

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

netstat -nap
OR
nmap fuser localhost

*on a default cPanel install these ports should be allowed, if not 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 ).

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:

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/Downloadtomcatdbcpjar.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!

If still nothing, check your config file /etc/my.cnf

nano /etc/my.cnf

*delete this line: skip-networking than save and quit and restart MySQL:

/etc/init.d/mysql restart

 

Red5 ADMIN NOT FOUND Red5 0.9

NOTE: We and numerous other clients/companies tried to run JabberCam, CRC 3 and other video software on Red5 0.9 ir 1.0 without success, we recommend using Red5 0.8 for the moment.

After installing Red5 0.9 or 1.0 and trying to access SERVER_IP:5080/admin/ you will (may) encounter the following error:

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:
*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

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:

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).

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)

<appender name="FILE">
<File>log/red5.log</File>
<Append>false</Append>
<rollingPolicy>
<FileNamePattern>log/red5.%dyyyy-MM-dd.log</FileNamePattern>
<MaxHistory>11</MaxHistory>
</rollingPolicy>
<Encoding>UTF-8</Encoding>
<BufferedIO>false</BufferedIO>
<ImmediateFlush>true</ImmediateFlush>
<layout>
<Pattern>%dISO8601 [%thread] %-5level %logger35 - %msg%n</Pattern>
</layout>
<triggeringPolicy>
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>

You can also separate Red5 logs using a Threshold Filter:

<appender name="FILE">
<File>log/red5errors.log</File>
<Append>false</Append>
<filter>
<level>WARN</level>
</filter>
...
</appender>

Everything you need to start your Red5 flash media server on a cPanel host and run JabberCam or similar chatroulette software is here. If we missed something and you found the solution, please post it here. At least a third of this description was sent to us by a user/client. Thank you for all the e-mails and feedbacks!

 

3 Comments Added

Add your message
  1. Dawn 04/11/2014 | Reply

    Hi! Can this setup be used to stream multiple file formats? I support a website for a non-profit that has different formats of videos (.wma, .m4v, .mov, .mp3). I would like to stream those. It is on a server that allows unlimited bandwidth.

    Thank you for your time!

    -Dawn

    • Chokri B.A. 04/11/2014 | Reply

      Hello Dawn,

      Yes this can be used to stream multiple file formats.
      Check out the StreamableFileFactory bean inside your red5-common.xml, to see what kind of files can be streamed by default (flv, mp3, mp4, m4a). If you copy any of these files in your red5 service’s streaming directory, it will be able to play it.

      Hope this helps 🙂

  2. james 06/03/2014 | Reply

    I cant access admin panel…

    Error i got is below.

    HTTP Status 500 – org.apache.jasper.JasperException: Unable to load class for JSP

    type Exception report

    message org.apache.jasper.JasperException: Unable to load class for JSP

    description The server encountered an internal error that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:161)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    root cause

    org.apache.jasper.JasperException: Unable to load class for JSP
    org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:630)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:149)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    root cause

    java.lang.ClassNotFoundException: org.apache.jsp.admin_jsp
    java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
    org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:628)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:149)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.36 logs.

    Please help mee…

Leave a Reply to Dawn Cancel reply

Contact us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Questions, issues or concerns? I'd love to help you!

Click ENTER to chat