All HowTo's Linux Redhat, Fedora and CentOS Linux Web Servers

How to Install and Test Tomcat6 on Redhat/CentOS

This article explains how to install and test Tomcat 6 on Redhat or CentOS Linux. Often you will simply download your java based application (such as OpenKM for example) packaged complete with Tomcat. But you can also do as we’re about to and install Tomcat by it’s self.

This article simply explains how to install Tomcat 6 and test that it works.

Install Tomcat via Yum:

yum install tomcat6

You can edit the configuration file “/etc/sysconfig/tomcat”. This file controls how Tomcat starts and which TCP port it should use. But only edit that file if you want to change defaults. Every option in that file comes commented out. By default, Tomcat will use TCP port 8080.

You can see where yum/rpm put the tomcat files by running:

rpm -ql tomcat6

The most interesting directory from the above command output is “/usr/share/tomcat6/webapps”. This is where your Java applet should be placed for execution.

You can alter the amount of memory Tomcat will use by editing the “/etc/sysconfig/tomcat6” file. Look for the variable below and set it as you like. For example:

JAVA_OPTS="-Xms256m -Xmx512m"

The above means:
-Xms set initial memory size
-Xmx set maximum memory size

Now to test it. Download the file from here “http://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war” and place it in the “/usr/share/tomcat6/webapps” directory.

Now visit the page: “http://server.example.com:8080/sample/” (notice you don’t specify the .war at the end) and you should see something like the following: