Apache Tomcat

Configuring Apache Tomcat 8 in Linux or Solaris

Install the Java Development Kit (JDK) from Oracle.
Add the environment variable $JAVA_HOME for system wide in /etc/profile or for single user in ~.bashrc


export JAVA_HOME
export PATH

2. Install Tomcat.
In Red Hat Linux, use yum:
# yum install tomcat
It will install in /etc/tomcat

To get Tomcat 8, download it from apache:

Move apache-tomcat-8.0.9.tar.gz to /usr/local/ directory and Extract.
This directory will become the CATALINA_HOME directory.

# tar -zxvf apache-tomcat-8.0.9.tar.gz
# CATALINA_HOME=/usr/local/apache-tomcat-8.0.9

Add this to the environment variable in /etc/profile.

3. Start Tomcat startup.sh located in /usr/local/apache-tomcat-8.0.9/bin

# $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-8.0.9
Using CATALINA_HOME: /usr/local/apache-tomcat-8.0.9
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.9/temp
Using JRE_HOME: /usr/java/jdk1.8.0_05/
Using CLASSPATH: /usr/local/apache-tomcat-8.0.9/bin/bootstrap.jar:/usr/local/apache-tomcat-8.0.9/bin/tomcat-juli.jar
Tomcat started.

4. View the Default Installation to confirm that the installation is working.
Tomcat default port is 8080
Enter the following address in a browser:

The configuration file that specifies the port number is server.xml
and it’s located in /usr/local/apache-tomcat-8.0.9/conf directory.

To setup the tomcat admin user and password edit tomcat-users.xml

server.xml – Primary configuration file for the Tomcat server components. This includes the configuration of Service, Connector, Engine, Realm, Valves, Hosts, and so on.

context.xml – Default version of the per-application configuration file for server components. Any components configured in this default file apply to all applications running on the server. An individual application can override the global configuration by defining its own context.xml file (placed in the META-INF directory of the application).

web.xml – Default version of the standard Java EE deployment descriptor for Web applications. This is used by Tomcat for all automatically deployed Web applications, or applications without their own specific deployment descriptor. If a Web application has its own deployment descriptor, its content will always override the configuration settings specified in this default descriptor.