Summary: This document outlines the process of installing and connecting Jakarta Tomcat version 5, Apache 2.0.x, and using Sun's JDK, all on a Redhat Linux 9 platform. This applies to Fedora users as well.
Install Apache. I used 2.0.49. Grab the source from apache.org and unpack it. Go in there and configure and compile it.
tar xzvf httpd-2.0.49.tar.gz
cd httpd-2.0.49
CFLAGS="-I/usr/kerberos/include" ./configure --enable-mod=so --enable-ssl --enable-mods-shared=all
make; make install
This puts the finished Apache in /usr/local/apache2 .
Install the JDK. Go to http://java.sun.com and follow the links to download the .bin installation package for linux. I ran it and installed the new directory in /usr/local/opt/.
Install Tomcat. This was done with jakarta-tomcat-5.0.19. Download the
binary package from http://jakarta.apache.org and unpack it. Like the JDK it's a
pre-built binary installation, so take the resulting jakarta-tomcat-5.0.19 directory
and put it where you want it; I put mine in /usr/local/opt/jakarta-tomcat-5.0.19
(that will be your catalina.base directory).
Go into the
{catalina.base}/conf directory and edit the tomcat-users.xml document. Add
a username and password for yourself that allows you to manage and
administer the Tomcat server over-the-web.
<user username="etrager" password="24skidoo" roles="admin,manager"/>
Create an init script that allows you start/stop/restart the server easily. Edit /etc/init.d/TOMCAT_5 with something like the following, editing the variables to fit your environment:
------------
#!/bin/sh cd /; umask 002 export JAVA_HOME=/usr/local/opt/j2sdk1.4.1_01 DIR=/usr/local/opt/jakarta-tomcat-5.0.18 # Start/stop processes required PATH=/usr/local/sbin:/usr/local/bin:$PATH PATH=/usr/bin:$PATH PATH=/usr/sbin:$PATH PATH=/sbin:$PATH PATH=$DIR/bin:$PATH PATH=$DIR/sbin:$PATH export PATH case "$1" in ''|'start') $DIR/bin/startup.sh ;; 'stop') $DIR/bin/shutdown.sh ;; 'restart') $DIR/bin/shutdown.sh # clean the cache. /bin/rm -rf $DIR/work/* $DIR/bin/startup.sh 2>&1 ;; *) echo "Usage: $0 { start | stop | restart }" ;; esac------------
Download jakarta-tomcat-connectors current source (for this I used
jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz). Unpack it. For this case
I put it in /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src . Go into /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2
. Configure it.
configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-java-home=/usr/local/opt/j2sdk1.4.1_01
Make it. Find the modules in /usr/cbel/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2 . Copy mod_jk2.so and jkjni.so into the apache modules directory.
Add load references to the apache conf file for the new modules:
LoadModule jk2_module modules/mod_jk2.so
Create an {apache.base}/conf/workers2.properties file and put in it:
[logger.apache2]
level=DEBUG
[shm]
file=/usr/local/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
Make sure there's an entry in the {catalina.base}/conf/server.xml for the
connector. Mine was there by default:
<Connector port="8009" protocol="AJP/1.3"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443">
</Connector>
Go into apache's httpd.conf and add a context that matches an existing URI
context for Tomcat. I used the jsp-examples context that was already
running in Tomcat. I added it after all other entries including virtual
hosts.
<Location "/jsp-examples">
JkUriSet worker ajp13:localhost:8009
</Location>
For the finished product, get tomcat running, then start apache. Try to load the context configured in httpd.conf. If that fails, try to access the Tomcat applications using the standalone web port (default is 8080). Keep in mind that by default firewalls typically block these "odd" ports.
If you need to, nmap the server with Tomcat running to make sure the right ports are open:
8005/tcp open unknown
8009/tcp open unknown
8080/tcp open unknown
(C)2004 Eric Trager.