Live Streaming

Full Version: Install Red5 on cPanel/WHM (CentOS) server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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/binaries/apache-ant-1.8.1-bin.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/perl-URI-1.35-3.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/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!

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>

Here you find an older description on how to install Red5 on cPanel, with pictures that may help: http://www.chatroulette-clone.com/questions/faq/installing-red5-cpanel/

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 forum users. Thank you for all the e-mails and forum posts!
Please!
we are trying to install Red 5 and we get the following error. Someone could help us?

root@srv1 [~]# cd /usr/local/red5

root@srv1 [/usr/local/red5]# ant prepare

Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine.
It seems like a heap limitation, lack of available virtual addresses for the heap. Try to change the maximum heap size. Ask your server admin or Google for the solution. The solution is dependent on the OS you are using.
I have some questions about the setup, and will appreciate if you can help..

1-------------------
Quote: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)
There is already an appender: <appender name="FILE" ..... with a different class on that file. So, do we have to comment out that one, or just leave it and add the one you wrote as an extra?

2---------------
http://serverIP:5080 (Red5 index page), the installer and demo pages are accessible by web.. Is this normal?

3--------------
I have added:
chkconfig --level 345 red5 on
So, Red5 starts after a reboot.. hope that's OK.. I never understood those runlevels.. i.e. the difference between --level 345 and --level 2345. I think --level 345 will do the job.

4--------------
Entering IP number of the server as host, I have all 'FAILED' on port tester on all ports.. What may be the reason??
(I installed Red5 version 0.8 exactly as on this thread, added port numbers on system-config-securitylevel so they are --i think-- open and accept connection, I also tried disabling firewall on system-config-securitylevel.. Nothing changed)

UPDATE:
trying to telnet to port 1935 fails:


telnet myserverIP 1935
Trying myserverIP...
telnet: connect to address myserverIP: Connection refused
telnet: Unable to connect to remote host: Connection refused

*******

# /usr/local/red5/red5.sh
Starting Red5
Exception in thread "main" java.lang.NoClassDefFoundError: org/red5/server/Bootstrap
Caused by: java.lang.ClassNotFoundException: org.red5.server.Bootstrap
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
Could not find the main class: org.red5.server.Bootstrap. Program will exit.

*********

netstat -anpt | grep 1935

returns blank








Thank you
That appender is OK, and optionally you can add the options to it to control the created logs. About the admin, this is by default. Usually people cannot do much using that admin interface, but you can delete (or move) it when you don't need it (needs a red5 restart). I guess this will be changed some day. The run levels are setting the priority when running a process so your setting will depend on how much priority would you like to give for red5 process. About the port test, there can be several reasons, try Google for an answer.
(06-07-2010, 11:24 AM)JabberCam Wrote: [ -> ]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

You've provided such detailed instructions, but skipped how to make ports accept connections if testing is failed. Please add it, because Linux if new area for me and I can follow step by step instructions only.
On a default cPanel install these ports are 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.
Red5 installation issues on a WHM VPS, CentOS 5.5 "virtuozzo"

I am having a problem, facing an error when running "ant prepare"
Code:
[property] java.io.IOException: Cannot run program "/bin/env": java.io.IOException: error=12, Cannot allocate memory

After hunting a lot for this I just got some tweaks to handle this exception, and every one has been using the way to handle this error.
I found a simple Java program (source below) which actually reproduces the error when running on a machine (WHM 11.26.8, CENTOS 5.5 i686 "virtuozzo") in my case. I am using a simple Java program only to reproduce the problem for the experts here so that they can provide a good solution to fix the problem I am facing during the Red5 Installation on the same VPS.
Java Program (DoRuntime.java)
Code:
import java.io.*;

public class DoRuntime {
   public static void main(String args[]) throws IOException {

      Runtime runtime = Runtime.getRuntime();

      long total = runtime.totalMemory();
      long max = runtime.maxMemory();
      long free = runtime.freeMemory();
      System.out.println("total: " + total);
      System.out.println("max: " + max);
      System.out.println("free: " + free);

      Process process = runtime.exec("/bin/ls");
      InputStream is = process.getInputStream();
      InputStreamReader isr = new InputStreamReader(is);
      BufferedReader br = new BufferedReader(isr);
      String line;

      while ((line = br.readLine()) != null) {
         System.out.println(line);
      }
   }
}

According to the references I found, if we are suck with the said error, we would need to specify the heap size on runtime(or set in conf)when running Java applications. So I tried to run the same program on my VPS where I was actually facing trouble during the Red5 Installation. Here I got exactly the same error (as in Red5 installation) when I run "java DoRuntime" with the above code in it.
Code:
[/usr/local/j2se]# java DoRuntime
total: 5177344
max: 532742144
free: 4972208
Exception in thread "main" java.io.IOException: Cannot run program "/bin/ls": java.io.IOException: error=12, Cannot allocate memory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
        at java.lang.Runtime.exec(Runtime.java:610)
        at java.lang.Runtime.exec(Runtime.java:448)
        at java.lang.Runtime.exec(Runtime.java:345)
        at DoRuntime.main(DoRuntime.java:15)
Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
        at java.lang.ProcessImpl.start(ProcessImpl.java:81)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
        ... 4 more

So when i tried to follow those options to specify the Heap Size while executing the above program, the system could not let Java avail the specified heap size. Following is what I got.
Code:
[/usr/local/j2se]# java "-Xms512m -Xmx512m" DoRuntime
Invalid initial heap size: -Xms512m -Xmx512m
Could not create the Java virtual machine.
Above even could not work with "-Xms1m -Xmx1m" or any other values. Same error was being resulted.

Any ways, I now tried to figure it out that what the hell is the problem now. I, then, just found some thing related to modify the SWAP space on the Linux machine on which all this sh!t is happening. And as I am not a very good in Linux, so I started searching on how could I modify SWAP Space, and blah blah.... finally when I got well stated tutorial for that I started going on. and what I got was just where I am currently stuck at...... :/ The WHM VPS "virtuozzo" is not letting me modify Swap size.

I am currently trying to get a workaround to fix this issue and posted a thread at
http://www.linuxquestions.org/questions/linux-general-1/swap-space-problem-833192/

But I am still stuck on it, and need a good solution if there is. I really need to install Red5 on the VPS mentioned. I even don't know if the problem is with the VPS.

Thanks
Do you have a 32 bit or 64 bit architecture?
Hello,

I follow the instructions on Windows 2008 with all libraries copied into c:\Program Files (x86)\Red5\webapps\JabberCamApp\WEB-INF\lib\
* commons-dbcp-1.4.jar
* mysql-connector-java-5.1.13-bin.jar
* tomcat-dbcp.jar

but I'm still experiencing:
[WARN] [WrapperSimpleAppMain] org.apache.catalina.core.NamingContextListener - Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]

Can you please help we with some suggestions?

Pages: 1 2