This tutorial is a guide to installing and configuring Apache Tomcat 6 for use as a standalone Web server (for development) that supports servlets 2.5 and JSP 2.1. (Note: Apache Tomcat is sometimes referred to as "Jakarta Tomcat" since the Apache Java effort is known as "The Jakarta Project").
To configure this you require JDK 1.5 or greater, I choose following two packages for my installation
1. jdk-1_5_0_14-linux-i586-rpm.bin
2. apache-tomcat-6.0.16.tar.
Installation of JAVA
The bin file is a self extract file run that file as
[root@localhost ~]#./jdk-1_5_0_14-linux-i586-rpm.bin
Once the rpm deployment is over, you will find the installation files on /usr/java
Now Set up a environment variable require for java in .bash_profile file
$PATH=/usr/java/jdk1.5.0_14/bin:$PATH
export PATH
export JAVA_HOME=/usr/java/jdk1.5.0_14
export CLASSPATH=.:/usr/java/jdk1.5.0_14/lib/tools.jar:/usr/java/jdk1.5.0_14/jre/lib/rt.jar
Why CLASSPATH - Since servlets and JSP are not part of the Java 2 platform, standard edition; you have to identify the servlet classes to the compiler. The server already knows about the servlet classes, but the compiler (i.e., javac) you use for development probably doesn't. So, if you don't set your CLASSPATH, attempts to compile servlets, tag libraries, or other classes that use the servlet and JSP APIs will fail with error messages about unknown classes.
Installing Tomcat 6
Extract the apache-tomcat-6.0.16.tar file as
[root@localhost ~]# tar –xvf apache-tomcat-6.0.16.tar
You’ll get a folder name apache-tomcat-6.0.16.
Rename this folder as tomcat6, and move to the location /usr/
[root@localhost ~]# mv apache-tomcat-6.0.16.tar /usr/tomcat6
Now Set up a environment variable require for tomcat in .bash_profile file
export CATALINA_HOME=/usr/tomcat6
export CATALINA_OPTS="-Djava.ext.dirs=/dummy_dir"
export CATALINA_TEMPDIR=/usr/tomcat6/temp
export JRE_HOME=/usr/java/jdk1.5.0_14/jre
export CLASSPATH=.:/usr/tomcat6/lib/servlet-api.jar:/usr/tomcat6/lib/jsp-api.jar:/usr/tomcat6/lib/el-api.jar
Here you have completed the installation and configuration of tomcat 6 and jdk 1.5.
Now to check that the setting is working properly, start the services of tomcat6 by running the startup.sh script. For stopping tomcat run shutdown.sh script.
[root@localhost ~]# ./ startup.sh
Go to browser and enter a url
http://localhost:8080 , you will get a tomcat welcome page.