Installing Tomcat (Release 4.1.12)

by Jeff Hunter, Sr. Database Administrator

Downloading Tomcat (Binary Version)

The binary version of the Tomcat Server can be downloaded from the Apache web site.

The software is located at:

Simply download the file jakarta-tomcat-4.1.12.tar.gz and place it in the directory where you want to install Tomcat. We typically perform the installation and configuration as the 'root' userid and place the archived file in the directory: /u02/app.

Installation Steps

# su -
# cd /u02/app
# gunzip jakarta-tomcat-4.1.12.tar.gz
# tar xvf jakarta-tomcat-4.1.12.tar
# ln -s jakarta-tomcat-4.1.12 tomcat
# rm jakarta-tomcat-4.1.12.tar

Environment Variables

Ensure that the following environment variables are set for the UNIX userid that will be administering (starting / stopping) the Tomcat servlet engine:

Variable Name Value Description
APACHE_HOME /u02/app/apache This is an optional parameter. It serves no purpose other than documentation in the .profile for the UNIX userid administering the server.
JAVA_HOME /usr/java Ensure that the JAVA_HOME variable is set to the root directory of your JDK hierarchy. This should already be part of the install you did with JDK.
CATALINA_HOME /u02/app/tomcat You may optionally set the CATALINA_HOME environment variable. If the supplied shell/batch scripts are executed from "jakarta-tomcat-<version>" or from its "bin" subdirectory, then they will successfully set CATALINA_HOME for you if not already set. If you wish to execute these shell/batch scripts from other directories, you must set CATALINA_HOME explicitly.
PATH ${PATH}:$JAVA_HOME/bin This should already be part of the install you did with JDK.
CLASSPATH ${CLASSPATH}: ${CATALINA_HOME}/common/lib/servlet.jar Needed to compile servlets.

Starting / Stopping / Testing Tomcat

At this point, it is a good time to test the Tomcat Servlet Container installation. Ensure that you test the JSP and Servlet examples. When all testing is complete and you are confident that Tomcat is working properly, shutdown the Tomcat application and continue on the remainder of this section for instructions on how to integrate Tomcat with Apache.


# ./
# ./

Use a browser and navigate to the URL below. Ensure that you test several of the servlet and JSP examples.


Configuring Tomcat (optional)

Located in the $CATALINA_HOME/conf directory is a file called server.xml.

The following table lists the default port settings for Tomcat.

Protocol Default Port
HTTP 8080
Ajp13 Interceptor 8009

NOTE FOR ORACLE8i USERS: If Tomcat is being installed on a server that already is configured with Oracle8i or higher, you may want to change several of the ports Tomcat uses as its default. In particular, port number 8007 will collide with Oracle's Jserv setup.

NOTE FOR LINUX USERS: If Tomcat is being installed on a Linux server (in particular, Red Hat Linux 7.2/7.3), then the default HTTP port used by Tomcat will collide with certain WWW cache services (webcache / WWW caching service). This will use both the UDP and TCP port.

The DBA on a Linux server running Oracle8i or higher might consider the following port assignments.

Protocol Default Port New Port
HTTP 8080 8090
Ajp13 Interceptor 8009 8029

The Tomcat Directory Structure

Directory Contains
/bin Contains the startup and shutdown scripts for both Windows and Linux.
/conf Contains main configuration files for Tomcat. The two most important are server.xml and the global web.xml.
/server Contains the Tomcat Java Archive files.
/lib Contains the JAR files that the servlet engine is dependant on.
/common/lib Contains the JAR files that are shared between Tomcat components.
/jasper Contains the JAR files that the JSP compiler, Jasper, depends on.
/logs Contains Tomcat's log files.
/src Contains the source code used by the Tomcat server. Once Tomcat is released, it will probably contain only interfaces and abstract classes.
/webapps The directory where all Web Applications are deployed, and where you place your WAR files, when it is ready for deployment.
/work The directory where Tomcat places all servlets that are generated from JSPs. If you want to see exactly how a particular JSP is interpreted, look in this directory.

Last modified on: Saturday, 18-Sep-2010 18:14:01 EDT
Page Count: 2037