Erik's Weblog 2.0

Installing Tomcat 3.2

[The Jakarata group is now releasing up-to-date RPMs on a regular basis. You might want to check there first.]

This installation guide is not a replacement for reading the Tomcat user guide, but hopefully will help someone avoid some of the problems I had to circumvent.

Versions You must become root to install Tomcat:
su -
Finding a Package

The first thing I did was look for a Tomcat 3.2.1 RPM, but could only find one for Tomcat 3.1. I decided to have a look at it. To keep things clean I created a tomcat-install directory in /tmp:
cd /tmp
mkdir tomcat-install
cd tomcat-install
I don't like getting files from (too busy and/or slow). I usually use
(ncftpget is a component of ncftp, my favorite ftp client. You may use any other the ftp client of your choice.)

I wasn't sure I wanted to install the RPM, but I figured I might learn something by looking at its content:
rpm -qpl tomcat-3.1-4.i386.rpm | more
I did learn a few things:
  1. A /etc/rc.d/init.d/tomcat file is enclosed
  2. Everything is installed in /opt/tomcat
  3. The documentation goes into /usr/doc/tomcat-3.1
I decided to install the RPM as it would give me a good base to start from:
rpm -ivh tomcat-3.1-4.i386.rpm
Now, I just had to upgrade Tomcat 3.1 to version 3.2.1.

Upgrading to Tomcat 3.2.1

First, I used lynx to get the Tomcat 3.2.1 tarball:
(You will be prompted to download and then save the file to disk.)

Uncompressed it:
tar -zxvf jakarta-tomcat-3.2.1.tar.gz
Remove the old Tomcat 3.1 /opt/tomcat directory:
rm -fr /opt/tomcat
Moved the new /opt/tomcat directory in its place:
mv jakarta-tomcat-3.2.1 tomcat
mv tomcat /opt
Created a symbolic link for the Tomcat 3.2.1 documentation in /usr/doc:
ln -s /opt/tomcat/doc /usr/doc/tomcat-3.2.1
Tomcat 3.2.1 is now installed!


After reading some more of the documentation I realized I also had to install mod_jk, a plugin which handles communication between Tomcat and Apache.

I could not find a mod_jk binary for Red Hat Linux and had to build it manually.

Building mod_jk

I used lynx, again, to get the Tomcat 3.2.1 source tarball:
Uncompressed it:
tar -zxvf jakarta-tomcat-3.2.1-src.tar.gz
The make file is located in the /src/native/apache1.3/ directory:
cd jakarta-tomcat-3.2.1-src/src/native/apache1.3/
Build the plugin with make:
make -f Makefile.linux all
Created the libexec directory in /etc/httpd:
mkdir /etc/httpd/libexec
Moved the plugin to the libexec directory:
mv /etc/httpd/libexec
The mod_jk plugin is installed!


Mommy told me to always clean up after myself:
cd /tmp
rm -rf tomcat-install

In order for the mod_jk plugin to work properly its configuration file must be included within Apache's. This is accomplished by appending:
Include /opt/tomcat/conf/mod_jk.conf-auto
Additionally, the tomcat service configuration file must be updated with the current Java VM and Tomcat home locations:

export JAVA_HOME=/usr/jdk118
export TOMCAT_HOME=/opt/tomcat
export JAVA_HOME=/usr/java/jdk1.3.0_01
export TOMCAT_HOME=/opt/tomcat
(JAVA_HOME should point to the location of your Java VM.)


For all of the configuration changes to take place, you must restart Tomcat and Apache:
cd /etc/rc.d/init.d
./tomcat restart
./httpd restart

Although not really needed, I've also added the following:
# tomcat
setenv JAVA_HOME "/usr/java/jdk1.3.0_01";
setenv TOMCAT_HOME "/opt/tomcat";
to my .login file:
I use tcsh for my shell, if you use another type of shell you might have to use:
# tomcat
In case of problems, do like I did, RTFM.