Installing Railo 3.1.0.012 on Linux Cent OS 5.2

 

How to install Railo:

Why another blog entry on the subject: because I was needed to read 5 different blogs to get it work properly.

Thanks to Railo Blog, Gary Gilbert, Chris aka hockeypFeF, Mike Benner and Mark Mcaulay for posting their own experiences how to install it.

To start you will need these tools

-bash-3.2# yum install make nano httpd-devel openssl-devel lynx

First of all we will need to get the latest jdk from Sun and install it

-bash-3.2# cd opt
-bash-3.2# mkdir soft
-bash-3.2# cd soft
-bash-3.2# curl -L -O
'http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u13-linux-i586.bin?BundledLineItemUUID=BXlIBe.p1iMAAAEgGLURNnCV&OrderID=r6lIBe.pMTMAAAEgCLURNnCV&ProductID=RGtIBe.ou1AAAAEfpVYcydOO&FileName=/jdk-6u13-linux-i586.bin'
-bash-3.2# chmod +x jdk-6u13-linux-i586.bin
-bash-3.2# ./jdk-6u13-linux-i586.bin 

You will need to press "enter" a couple of time to acknowledge the liscence and press "Y" at the end.

When it's done we need to add Java to our path

-bash-3.2#  nano /etc/profile.d/java.sh

In this file add these 2 lines:

export JAVA_HOME=/opt/soft/jdk1.6.0_13/
export PATH=$JAVA_HOME/bin:$PATH

Save your file and make it executable like that:

-bash-3.2# chmod +x /etc/profile.d/java.sh

Now you have to log off of SSH and comeback in

You will be able to test if java is properly install with this command line

java -version

If Java is properly install you will have the java version intall

Now we need to download Railo

-bash-3.2# cd opt


-bash-3.2# wget http://www.getrailo.org/down.cfm?item=/railo/remote/download/3.1.0.012/server/all/railo-3.1.0.012-resin-3.1.2-without-jre.tar.gz

We extract Railo with this command line

-bash-3.2# tar xzf railo-3.1.0.012-resin-3.1.2-without-jre.tar.gz

Making a relative path to the folder extract to simplify the writing

-bash-3.2# ln -s railo-3.1.0.012-resin-3.1.2-without-jre railo

Now the interesting part the compiling of the module Caucho

-bash-3.2# cd railo


-bash-3.2# ./configure --with-java-home=/opt/soft/jdk1.6.0_13/ --with-apxs=/usr/sbin/apxs


-bash-3.2# make 


-bash-3.2# make install

if everything is fine no errors occurs during the last 3 steps

You can look into your httpd.conf file these new lines will be at the end of your file

-bash-3.2# nano /etc/httpd/conf/httpd.conf

#
# mod_caucho Resin Configuration
#

LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so

ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

Now we need a script to railo start automatically at the startup

-bash-3.2# nano /etc/init.d/resin

##############################################
#!/bin/sh
#
# Linux startup script for Resin
# chkconfig: 345 85 15
# description: Resin is a Java Web server.
# processname: wrapper.pl
#
#
JAVA_HOME=/your/java/path for me it's /opt/soft/jdk1.6.0_13
RESIN_HOME=/your/resin path for me it's /opt/railo

export JAVA_HOME RESIN_HOME

JAVA=$JAVA_HOME/bin/java
#
# If you want to start the entire Resin process as a different user,
# set this to the user name. If you need to bind to a protected port,
# e.g. port 80, you can't use USER, but will need to use bin/resin.
#
USER=
#
# Set to the server id to start
#
#SERVER="-server app-a"
#
ARGS="-resin-home $RESIN_HOME $SERVER"

if test -r /lib/lsb/init-functions; then
. /lib/lsb/init-functions
else

log_daemon_msg () {
if [ -z "$1" ]; then
return 1
fi

if [ -z "$2" ]; then
echo -n "$1:"
return
fi

echo -n "$1: $2"
}

log_end_msg () {
[ -z "$1" ] && return 1

if [ $1 -eq 0 ]; then
echo " ."
else
echo " failed!"
fi

return $1
}

fi

case "$1" in
start)
logger "Starting resin"
if test -n "$USER"; then
su $USER -c "$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS start" 1>/dev/null 2>/dev/null
else
$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS start 1>/dev/null 2>/dev/null
fi
logger $?
;;
stop)
logger "Stopping resin"
if test -n "$USER"; then
su $USER -c "$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS stop" 1>/dev/null 2>/dev/null
else
$JAVA -jar $RESIN_HOME/lib/resin.jar $ARGS stop 1>/dev/null 2>/dev/null
fi
logger $?
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit 0

Save the your file and we need to made it executable and bootable at the startup

We do that with these 3 lines

chmod +x /etc/init.d/resin
chkconfig --add resin
chkconfig resin on

You can configure your differents website in the resin.conf

-bash-3.2# nano /opt/railo/conf/resin.conf

<host id="www.mysite-two.com">
<host-alias>mysite-two.com</host-alias>
<root-directory>/path/to/web/files</root-directory>
<web-app id="/">
<document-directory></document-directory>
 </web-app>
</host>

you will find the server admin of railo here

http://you.ip/railo-context/admin.cfm

and the webserver admin for each domain you add in your resin.conf here

http://host/railo-context/admin.cfm

Cleanup

You can now delete the 2 files you download the jdk-6u13-linux-i586.bin and the railo-3.1.0.012-resin-3.1.2-without-jre.tar.gz

also in the directory /opt/railo you can delete that

-bash-3.2# rm -rf httpd.exe install-service.bat remove-service.bat setup.exe win32

| View count: 16237
del.icio.us Digg StumbleUpon Facebook Technorati Fav Google Bookmarks DZone
  1. Gringa

    #1 by Gringa - June 16, 2009 at 11:00 PM

    Great article! After running the ".confgure" line of code, I was stumped when I got an error message reading:

    checking for JAVA_HOME... /opt/soft/jdk1.6.0_13/

    configure: error: Can't find valid JAVA_HOME /opt/soft/jdk1.6.0_13/

    If anyone else there gets this error message, I'm happy to say I found a fix! I had simply copied and pasted your line of code above, which reads, "./configure --with-java-home=/opt/soft/jdk1.6.0_13/ --with-apxs=/usr/sbin/apxs" line"

    If you get the "cannot find Java_Home" error, it probably means that your Java_home is not at /opt/soft/jdk1.6.0_13/.

    As it turns out, the Java_Home on my VPS is at /usr/java/jdk1.6.0/.

    The fix: Change the .configure command to reflect your Java_Home. I changed mine to the below and Railo installed without further errors.

    ./configure --with-java-home=/usr/java/jdk1.6.0/ --with-apxs=/user/sbin/apxs
  2. Pierre-Olivier Chassay

    #2 by Pierre-Olivier Chassay - June 17, 2009 at 10:14 AM

    Glad my post help you
  3. Steve

    #3 by Steve - June 25, 2009 at 11:25 AM

    Thanks very much - great guide.
    For anyone following this as literally as I was, the versions of Java and Railo have changed since this was written, so that's something to watch out for and check before you begin. Also, I found
    I needed this line to get things going finally:
    /opt/railo/bin/httpd.sh start
  4. Ben Montanelli

    #4 by Ben Montanelli - July 16, 2009 at 10:39 PM

    Well done. I was getting very frustrated trying to get everything up as service at system startup.

    Above worked fine with my variation:
    - CentOS 5.3 (xen paravirtual to LVM)
    - Java 5 (1.5.0_18)
    - railo-3.1.0.022-resin-without-jre

    A major stumbling block for me was that symbolic links do not appear work within service parameters, it needed the full path. Otherwise Railo Blog/Gert Franz "should" work (with the chmod statements included to make it more complete).

    Is there a difference between chmod 755 and chmod +x ?

    I was afraid I was going to have to go the whole Eclipse route which, while solid, is a bit overkill for a quick compile and install on CentOS.

    And thanks for the heads up on nano, very quick and handy on these little edits.
  5. Pierre-Olivier Chassay

    #5 by Pierre-Olivier Chassay - September 12, 2009 at 12:30 PM

    For spamming reason on this post no more comments will be allowed. Please send me a message via the contact form if you wants to post something here.

Comments are closed.