Install Apache Tomcat 7.0 on RHEL 6 / CentOS 6

Tomcat LogoApache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle and provides a “pure Java” HTTP web server environment for running the Java codes.  Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files.

Here is the step by step guide to install Apache Tomcat 7.0 on RHEL 6 / CentOS 6.

Open Terminal.

Switch to root user.

Install OpenJDK:

Tomcat requires to have java installed on your machine, you can either have Oracle JDK or OpenJDK installed on your machine. Here i used the openjdk, lets install openjdk by issuing the following command.

[root@server ~]# yum install java-1.7.0

You can also verify it, by issuing the following command.

[[email protected] ~]#  java -version
java version “1.7.0_51”
OpenJDK Runtime Environment (rhel- u51-b02)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Download & Setup Apache Tomcat:

Download the latest version of the Apache Tomcat from the website and save it on your home directory.

[root@server ~]# wget

Download the MD5 file.

[root@server ~]# wget --no-check-certificate

Verify the md5 check sum of the downloaded Tomcat archive with check sum provided by Apache Tomcat.

[root@server ~]# cat apache-tomcat-7.0.52.tar.gz.md5
3d780939cc4fce1661e7411bbd640c09 *apache-tomcat-7.0.52.tar.gz
[root@server ~]# md5sum apache-tomcat-7.0.52.tar.gz
3d780939cc4fce1661e7411bbd640c09  apache-tomcat-7.0.52.tar.gz

If both matches, extract the the tomcat on to your desired (/var/local) directory.

 tar -zxvf apache-tomcat-7.0.26.tar.gz -C /var/local/

Controlling Apache Tomcat:

Apache Tomcat can be  started and stopped by the script which comes with package, start the Apache Tomcat.

[root@server ~]# /var/local/apache-tomcat-7.0.26/bin/

you will get the following out.

[[email protected] ~]# /var/local/apache-tomcat-7.0.52/bin/
Using CATALINA_BASE:   /var/local/apache-tomcat-7.0.52
Using CATALINA_HOME:   /var/local/apache-tomcat-7.0.52
Using CATALINA_TMPDIR: /var/local/apache-tomcat-7.0.52/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /var/local/apache-tomcat-7.0.52/bin/bootstrap.jar:/var/local/apache-tomcat-7.0.52/bin/tomcat-juli.jar
Tomcat started.

You can verify the service running, by default tomcat runs on port no 8080

[root@server ~]# netstat -antup | grep 8080
tcp        0      0      *                   LISTEN      2476/java

Open the web browser and point to http://ipaddress:8080

Tomcat Home

Stop the Apache Tomcat.

[root@server ~]# /var/local/apache-tomcat-7.0.26/bin/

Managing the Apache Tomcat:

Tomcat can be managed through the web-manager, the following can be done through that.
Deploy new application, deploy new application on specified context, list the active or in active applications, start and stop the web applications.

Web manager is password protected, requires user name and password to access. Only the user with the “manager-gui” role is allowed to access, these users and roles are defined in tomcat-users.xml. By default “manager-gui” role not defined that file, we need to add it manually.

vi /var/local/apache-tomcat-7.0.52/conf/tomcat-users.xml

Place the following two lines just above the last line.

<role rolename=”manager-gui”/>
<user username=”tomcat” password=”tomcat” roles=”manager-gui”/>

Stop and Start the tomcat, now tomcat user have access to the web manager.

Tomcat  Manager

same like, you can define the other roles.

That’s All.


Share This Post

  • moncler gerard

    Heya i am for tɦe fіrst time here. I fοund this board
    and I find Іt really useful & it helрed me out a lot.
    I hope to give somethiոg back and aid others like
    you helped me.

  • Ilango

    Hi, I am not able to see the Tomcat welcome page as given below. It is Tomcat v 7.0.59 and centos 6.6.
    Open the web browser and point to http://ipaddress:8080

    Once I given the URL “The connection was reset” in Firforx. Any idea

    • Raj

      Dear Ilanga,

      Please check the IP table, make sure you have done proper rule to allow a traffic on port 8080

      iptables -A INPUT -p tcp –dport 8080 -j ACCEPT

      • Ajay Singh


        i have installed the jdk.

        but i facing an error at the level/step “Download & Setup Apache Tomcat:”

        404 Not Found.

        number of times. can you help me out with this

        • Raj

          Please chk the tomcat download URL