Apache Tomcat
Server Training - Web Server


Apache Tomcat uses the Java Servlet and JavaServer Pages technologies.  Java Servlet technology enables a mechanism for extending the functionality of a Web Server with Java. JavaServer Pages (JSP) technology provides a fast way to create dynamic for a Web Server. This also explains how to install Ant a Java-based build tool.

During the installation process you will create a home directory for Tomcat.
The home directory for Tomcat is $CATALINA_HOME. The /bin directory contains
the startup and shutdown scripts. The /conf directory contains the main configuration
file called server.xml. You will find /logs for your log files and /webapps.

1. Download the java jdk and jre from http://java.sun.com

This can be very frustrating as you will want to find the correct files and if this is a first time venture into Java it is hard to understand what is what. You need two files to download to the /root directory of your Linux box. The two files are jre-6ux and jdk-6ux, the actual versions are listed below but the update number may have changed by the time you read this.

Here are the versions used in the example, be sure to change version numbers if you have downloaded different versions.

Install as the root user.

# mkdir /usr/java # cd /usr/java

Execute the script, make sure you have the correct path to the script.

# sh /root/jre-6u7-linux-i586-rpm.bin
# sh /root/jdk-6u7-linux-i586-rpm.bin

2. Download apache-ant apache-tomcat from http://www.apache.org
When you download these files save them in /usr/share.

3. Unzip ant and tomcat to /usr/share
Be sure to note any version changes that you download.

# cd /usr/share # tar -xzf apache-tomcat-6.0.16.tar.gz # tar -xzf apache-ant-1.7.1-bin.tar.gz

4. Create ant link
This will allow ant to work correctly.

# ln -s /usr/share/apache-ant-1.7.1/bin/ant /usr/bin/

5. Create $env for JAVA_HOME , can be done inside catalina.sh

# cd /usr/share/apache-tomcat-6.0.16/bin # vi catalina.sh

At the top of the file, after the first line, add this information. Be sure it reflects your version number.


6. Verify the Setup by running tomcat

# cd /usr/share/apache-tomcat-6.0.16/bin # ./startup.sh

After it has started check your log files to verify there are no errors. If there are errors document them and fix them before moving forward.

# less /usr/share/apache-tomcat-6.0.16/logs/catalina.out

Once you have fixed all errors and started again with no errors Tomcat is fully functional.

7. Create symbolic link for tomcat

# ln -s /usr/share/apache-tomcat-6.0.16/bin/startup.sh /usr/bin/tomcat

Running Tomcat

In order to run tomcat you must execute the scripts found in the bin directory of the tomcat home.




Tomcat runs on port 8080.  So to test your installation go to http://localhost:8080/