Installing Railo with Resin on Slackware 13

Published: {ts '2011-05-07 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/installing-railo-with-resin-on-slackware-13/

I wrote this guide on how to install Railo on Resin a few months back before I switched to Tomcat. I'm putting it up for anybody who is interested. Myself I recommend using Tomcat and the new installer that the Railo team have developed.

This install guide covers installing Railo 3 with Resin on Slackware 13 where Apache and Java are already installed.

Pre-Requisites

Before we get to installing Railo we need a few other things installed first. As you can see slackware normally comes with these pre installed. If you are missing any of these then install them first before continueing.

Get Railo

Go to http://www.getrailo.org and download the latest stable release. I downloaded the resin-without-jre.tar.gz file as I already have java configured.

Note: I downloaded the 3.1.1.000 version as there was an issue with the 3.1.2 release that causes a problem when trying to run the "make" command. If you need it the link for the 3.1.1.000 release is here Railo Resin 3.1.1.000 . Railo is self updating so its easy to update to a newer version once installation is finished.

Unpack Railo

Save the downloaded tarball into the "/opt" directory. Then cd into opt and unpack the downloaded file with the following commands.

cd /opt tar -xzvf railo[version].tar.gz

Cleanup

Railo has now been unpacked to a directory with a really long name and several unnecessary files. So our next step is a bit of house cleaning.

Firstly we delete the original tarball. We then create a soft link to the railo directory which we simply name railo. Finally we enter the railo directory and clean out some unnecessary files.

rm -rf railo[version].tar.gz ln -s railo[version] railo cd railo rm -rf httpd.exe install-service.bat remove-service.bat setup.exe win32

Set Java in Startup script

As we are using the "without-jre" jar file we need to configure Railo to find java. To do this we edit the railo start script "/opt/railo/bin/httpd.sh" and set the java path directive "java=java" line to read as follows.

#comment out this #java=java #and add this where ${JAVA_HOME} points to /usr/lib/java in slackware java=${JAVA_HOME}/bin/java

Test Railo

At this stage we have Railo installed and we can test it running. First we chown railo so that our user owns it. Then we execute the httpd.sh file.

chown -R {your username} railo /opt/railo/bin/httpd.sh

Open a web browser and goto "http://{yourLinuxBox}:8600/". At this stage if everything went well we should see a webpage with some dump information and a link to the admin page.

Configure the Apache Connector

The next step is very easy, all we need are need two paths. The first is the path to java which we can find by simply calling echo on the JAVA_HOME variable, the second is the path to apxs which on slackware is "/usr/sbin/apxs2".

We cd into the railo directory and run the configure command passing in our two required paths. Finally we call "make" and "make install".

cd /opt/railo ./configure --with-apxs=/usr/sbin/apxs --with-java-home=/usr/lib/java make make install

Check and Confirm httpd.conf

At this stage the make command should have appended 4 lines to the bottom of our "httpd.conf" file. These should read something like this.

LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so ResinConfigServer localhost 6800 CauchoConfigCacheDirectory /tmp CauchoStatus yes

If all is set then we need to make one small modification to the Directory Index setting to tell apache to serve index.cfm files if a file is not explicitly named.

DirectoryIndex index.cfm index.html

Restart apache and test by going to "http://{yourLinuxBox}"

/etc/rc.d/rc.httpd restart

Setup vhosts

For every vhost in our apache vhosts.conf file that will use railo we must also add an entry into the resin.conf file. Edit "/opt/railo/conf/resin.conf" and add the following for each vhost modified for each host.

neiland.net www.neiland.net some other alias

It is not strictly necessary but I like to give railo its own vhost and explicitly set which other vhosts use railo.

Create a vhost named "railo" in the httpd-vhosts.conf file and move the railo commands from the httpd.conf file into here. Here I have enabled the status page. Copy and modify this as needed for each vhost that uses Railo.

ServerName railo.localhost DocumentRoot "/path/to/railo/htdocs/" #Resin / railo config LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so ResinConfigServer localhost 6800 CauchoConfigCacheDirectory /tmp CauchoStatus yes #Setup caucho-status location SetHandler caucho-status #Logging --snip--

Start Railo/Resin on bootup

In "/opt/railo/contrib" is an init script. This should already have the correct paths specified. Simply copy the file to "/etc/rc.d/" and name it "rc.resin". Then add the follow to "/etc/rc.d/rc.local"

if [ -x /etc/rc.d/rc.resin ]; then /etc/rc.d/rc.resin start fi

You must give rc.resin execute permission

chmod 755 /etc/rc.d/rc.resin

Its also a good idea to use the apache user for railo.

chown -R apache:apache /opt/railo

Note: As of railo-3.1.1 and Resin 3.1.2, the contrib/init.resin file IS NOT CORRECT. Below is mine.

  1. "-pid $PID" is not a valid argument
  2. "start"/"stop" should be after $ARGS
  3. "-java_home" is not a valid argument
  4. "-resin_home" should be "-resin-home"
  5. The "$PID" file is no longer created, so remove all code referencing it.
JAVA_HOME=/usr/lib/java RESIN_HOME=/opt/railo export JAVA_HOME RESIN_HOME USER= EXE=$RESIN_HOME/bin/httpd.sh ARGS="-resin-home $RESIN_HOME" case "$1" in start) echo -n "Starting resin: " if test -n "$USER"; then su $USER -c "$EXE $ARGS start" else $EXE $ARGS start fi echo ;; stop) echo -n "Shutting down resin: " $EXE stop echo ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0

Access the Railo Status and Administration

There are two admin interfaces to worry about. The "server admin" which defines the global settings and the "web admin" which defines the per site settings. For a good explanation of each goto here.

Server Administrator:

http://127.0.0.1/railo-context/admin/server.cfm

Web Administrator:

http://127.0.0.1/railo-context/admin/web.cfm

Server Status:

For a quick look at the servers status.

http://127.0.0.1/caucho-status

Set Admin Passwords and Update

The first thing I always do when setting up a new railo box is before I create and vhosts I login to the server admin set the password and set the debugging output to false. This setting can be overridden in the web admin on a per site basis but first we want to prevent it from being set true for each site.

Finally go to the update section and tell railo to check for updates and set if you want automatic updates or manual. I choose manual just so I can let other people test current patches first.