8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23ai | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Linux » Here

Apache Tomcat 7 Installation on Linux (RHEL and clones)

Apache Tomcat 7 is not available from the standard RHEL distributions, so this article provides information about the manual installation and basic configuration of Apache Tomcat 7 on RHEL and its clones from tarballs. The tarball approach to installation is largely unchanged compared to previous tomcat versions.

Related articles.


Download the following software. The installation will work with either JDK7 or JDK8, so pick which you prefer. This article assumes these downloads are present in the "/tmp" directory on the server.


Create a user called "tomcat" to own the Tomcat installation.

# useradd tomcat

Install the JDK (7 or 8) from the tarball under the tomcat user.

# su - tomcat

$ tar xzf /tmp/jdk-7u79-linux-x64.tar.gz

# or

$ tar xzf /tmp/jdk-8u77-linux-x64.tar.gz

Install Tomcat from the tarball under the home directory of the "tomcat" user.

$ tar xzf /tmp/apache-tomcat-7.0.68.tar.gz

Set the following environment variables and append them to the "/home/tomcat/.bash_profile" so they are set for subsequent logins. Remember to set the desired JAVA_HOME correctly.

#export JAVA_HOME=/home/tomcat/jdk1.7.0_79
export JAVA_HOME=/home/tomcat/jdk1.8.0_77
export CATALINA_HOME=/home/tomcat/apache-tomcat-7.0.68

Start and stop Tomcat using the following scripts.

$ $CATALINA_HOME/bin/startup.sh
$ $CATALINA_HOME/bin/shutdown.sh

The Tomcat logs are written to the "$CATALINA_HOME/logs/" directory by default.

Once Tomcat is started, the following URL should be available. Configuration for the management URLs is discussed below.


Remember to open up the port on the firewall if you want to access the site from other servers on the network. Information about the Linux firewall is available here.

Checking the Status of Tomcat

There are several ways to check the status of the service.

$ netstat -nlp | grep 8080
tcp        0      0 :::8080                     :::*                        LISTEN      19034/java           

$ ps -ef | grep tomcat
root      3198  3062  0 14:56 pts/0    00:00:00 su - tomcat
tomcat    3199  3198  0 14:56 pts/0    00:00:00 -bash
tomcat    3601     1  6 15:08 pts/0    00:00:02 /home/tomcat/jdk1.8.0_77/bin/java -Djava.util.logging.config.file=/home/tomcat/apache-tomcat-7.0.68/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/home/tomcat/apache-tomcat-7.0.68/endorsed -classpath /home/tomcat/apache-tomcat-7.0.68/bin/bootstrap.jar:/home/tomcat/apache-tomcat-7.0.68/bin/tomcat-juli.jar -Dcatalina.base=/home/tomcat/apache-tomcat-7.0.68 -Dcatalina.home=/home/tomcat/apache-tomcat-7.0.68 -Djava.io.tmpdir=/home/tomcat/apache-tomcat-7.0.68/temp org.apache.catalina.startup.Bootstrap start
tomcat    3631  3199  0 15:09 pts/0    00:00:00 ps -ef
tomcat    3632  3199  0 15:09 pts/0    00:00:00 grep --color=auto tomcat

$ curl -I http://localhost:8080
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Sat, 19 Mar 2016 15:09:53 GMT


The status is also available from the HTML management page.

Configuration Files

The main locations of configuration and log information are shown below.

Release Notes        : $CATALINA_HOME
Bin Directory        : $CATALINA_HOME/bin
Config               : $CATALINA_BASE/conf
Webapps              : $CATALINA_BASE/webapps
Logs                 : $CATALINA_BASE/logs

Enabling HTML Management Access

Edit the "$CATALINA_HOME/conf/tomcat-users.xml" file, adding the following entries inside "tomcat-users" tag. Adjust the password as required.

<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="MyPassw0rd!" roles="manager-gui,admin-gui"/>

Restart Tomcat for the configuration to take effect.

$ $CATALINA_HOME/bin/shutdown.sh
$ $CATALINA_HOME/bin/startup.sh

The management application is now available from the "http://localhost:8080/manager/html" URL.

Deploying Applications

You can get a sample application WAR file to test with from "http://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/".

If this is a redeployment, delete the existing deployment from the "$CATALINA_BASE/webapps" directory.

# rm -Rf $CATALINA_BASE/webapps/sample

Place the "sample.war" file in the "$CATALINA_BASE/webapps" directory and Tomcat with automatically deploy it. You will see a "sample" directory appear.

You don't need to stop and start Tomcat for this to work, but you can if you want.

$ $CATALINA_HOME/bin/shutdown.sh
$ $CATALINA_HOME/bin/startup.sh

For more information see:

Hope this helps. Regards Tim...

Back to the Top.