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 contrib.redhat.com (too busy and/or slow). I usually use ftp-linux.cc.gatech.edu:
ncftpget ftp://ftp-linux.cc.gatech.edu/pub/linux/distributions/redhat/contrib/libc6/i386/tomcat-3.1-4.i386.rpm
(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:
- A /etc/rc.d/init.d/tomcat file is enclosed
- Everything is installed in /opt/tomcat
- 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:
lynx http://jakarta.apache.org/builds/tomcat/release/v3.2.1/bin/jakarta-tomcat-3.2.1.tar.gz
(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!
mod_jk
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:
lynx http://jakarta.apache.org/builds/tomcat/release/v3.2.1/src/jakarta-tomcat-3.2.1-src.tar.gz
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 mod_jk.so /etc/httpd/libexec
The mod_jk plugin is installed!
Cleanup
Mommy told me to always clean up after myself:
cd /tmp
rm -rf tomcat-install
Configuration
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
To:
/etc/httpd/conf/httpd.conf
Additionally, the tomcat service configuration file must be updated with the current Java VM and Tomcat home locations: Change:
export JAVA_HOME=/usr/jdk118
export TOMCAT_HOME=/opt/tomcat
To:
export JAVA_HOME=/usr/java/jdk1.3.0_01
export TOMCAT_HOME=/opt/tomcat
In:
/etc/rc.d/init.d/tomcat
(JAVA_HOME should point to the location of your Java VM.)
Restarting
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
Done!
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:
~/.login
I use tcsh for my shell, if you use another type of shell you might have to use:
# tomcat
JAVA_HOME=/usr/java/jdk1.3.0_01
TOMCAT_HOME=/opt/tomcat
export JAVA_HOME TOMCAT_HOME
In case of problems, do like I did, RTFM.
Enjoy!