OrderlyStats Server Edition - Tomcat Installation

FREE INSTALLATION SUPPORT is available for OrderlyStats - so if you get stuck just give us a call or, write in.

3. Install Tomcat 5 or 5.5

OrderlyStats SE is not yet compatible with Tomcat 6 - we are working on this. The recommended version is 5.5

Although some distributions have a Tomcat 5.5 package available, we have found these tricky to install and configure, and prone to upgrade problems.

You're better off downloading Tomcat directly from the Apache Software Foundation at http://tomcat.apache.org/download-55.cgi. Choose the latest Binary Distribution, or use this direct link (right-click to save).

Once you've got the file, unpack it with tar -xvzf apache-tomcat-5.5.28.tar.gz
This will create a new folder containing Tomcat.

Next, move Tomcat to a more convenient location with mv apache-tomcat-5.5.28 /usr/share/tomcat
This will be your CATALINA_HOME. You may find it easiest to save this as an environment variable while you're doing the rest of the installation by running:

export CATALINA_HOME=/usr/share/tomcat

Now we need to create a script to start and stop Tomcat. Create a new file with nano /etc/init.d/tomcat and paste in the following cross-distribution startup script (or download it here):

#!/bin/bash
#
# Startup script for the Tomcat server
#
# chkconfig: - 83 53
# description: Starts and stops the Tomcat daemon.
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/java			#You may need to edit this line
export CATALINA_HOME=/usr/share/tomcat		#You may need to edit this line
export CATALINA_OPTS="-Xmx256M"
export CATALINA_PID=/var/run/tomcat.pid
export NICENESS=10

#See how we were called.
case $1 in
        start)
		sh $CATALINA_HOME/bin/shutdown.sh -force
                nice -n $NICENESS $CATALINA_HOME/bin/startup.sh
        ;;
        stop)
                sh $CATALINA_HOME/bin/shutdown.sh -force
        ;;
        restart)
                sh $CATALINA_HOME/bin/shutdown.sh -force
                nice -n $NICENESS $CATALINA_HOME/bin/startup.sh
        ;;
        *)
                echo "Usage: /etc/init.d/tomcat start|stop|restart"
        ;;
esac

exit 0

If you used a different location for your JAVA_HOME or CATALINA_HOME directories, you will need to edit the lines indicated.

Save the file and exit, and make it executable with chmod 755 /etc/init.d/tomcat

Now, try starting tomcat with /etc/init.d/tomcat start

If tomcat has started correctly, you should be able to see it running with ps -ef | grep java

NOTE: By default Tomcat listens for web requests on port 8080. On some distributions the default port is 8180. You can change the port by editing $CATALINA_HOME/conf/server.xml

NOTE: If your OrderlyStats server is running behind a firewall, you will need to allow traffic on port 8080, and also port 8081 (which is used for the Realtime Control Panel and Agent Bar).

NOTE: If you want OrderlyStats to start automatically whenever your server is rebooted, you will have to add startup links that point to /etc/init.d/tomcat to achieve this (usually in /etc/rc2.d). You should make sure tomcat is started after your database. Please see your linux distribution documentation for further details.

For best results, it's a good idea to restart tomcat each night when your call centre is closed. To do this, create a script with nano /etc/cron.daily/tomcat

Copy and paste in the following:

#!/bin/sh

test -x /etc/init.d/tomcat || exit 0
/etc/init.d/tomcat stop >/dev/null 2>&1
sleep 10
/etc/init.d/tomcat start >/dev/null 2>&1

You also need to make this script executable with chmod 755 /etc/cron.daily/tomcat

As a final test, make sure you can see the Tomcat default home page by opening a browser window, and accessing http://my.ip.address:8080/

Up Next: Install the OrderlyStats SE Core...

NOTE: FREE INSTALLATION SUPPORT is available for OrderlyStats - so if you get stuck just give us a call or, write in.
Prev: Install Java Up: Table of Contents Next: Install OrderlyStats SE Core...