Install tomcat on centos

This tutorial is about How to Install Apache Tomcat 7 on Centos 7 / RHEL 7 using Yum. Apache Tomcat is a web server and servlet container that is used to serve Java applications and pages. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation.

Our Testing Environment :
  • OS – Centos 7
  • Application – Apache Tomcat Web Server

How to Install Apache Tomcat

  1. Run the following command to install Tomcat 7 Package.

This command will Install Tomcat 7 with their dependencies like Java and it will also create Tomcat User.

Few things you need to know about Tomcat, Tomcat Files are located in /usr/share/tomcat. If you want to run a Tomcat application, then place it in /usr/share/tomcat/webapps directory. we Installed Tomcat Packages in step 1, But we need to install few additional packages that will help you to manage your tomcat applications and virtual hosts.

Install Admin Packages

2. If you are just started with Apache Tomcat, You will most likely want to install some admin tools that will help you to deploy your Java Applications and manage your virtual hosts. There are few packages that include these tools as web applications.

  • To Install the default Tomcat root page : tomcat-webapps
  • Tomcat Web Application Manager and Virtual Host Manager : tomcat-admin-webapps

Run the following command.

This command will add the ROOT, Examples, sample, manager and host-manager web apps to the tomcat/webapps directory.

Install Online Documentation (Optional)

3. If you want to Install Tomcat Documentation. So, All of the links on the default Tomcat page will work. for that type the following command.

Configure Tomcat Web Management Interface

4. In order to use the manager webapp that we installed in the step 2, we must add a login to our Tomcat server. for that type the following command to edit tomcat-users.xml file.

Add User Apache Tomcat :

Make sure you changed the username and password. then save and exit the tomcat-user.xml file.

Start Tomcat

5. Now, We are ready to start the tomcat service. To start Apache Service type the following command.

  • To restart Tomcat :

  • To start Tomcat Automatically after Reboot (Persist) :

Access the Web Interface

6. Now, We done with Tomcat configuration part and Tomcat service is also running. Let’s test Tomcat web management interface in a web browser, for that just type the following in url section of any browser like chrome,etc.

if you don’t know your server ip type the following command :

Preview :

install tomcat on centos 7

We done with tomcat installation. Let’s take a look on advance part of Tomcat like Manager App and Host Manager.

Manager App

7. Now, To access the Web Application manager click on “Manager App” as shown in picture below.

manager app tomcat

Type Username and Password that we given at step 4

tomcat manager app login

After doing authentication you will be see Tomcat web Application GUI Like that

The Web Application manager basically used to Manage your Java Application. You can Start, Stop, Reload, Deploy and Undeploy here. You can also run some diagnostics on your apps link find memory leaks,etc. And all information of your server is available at the bottom of the page as shown below.

Host Manager

8. From Virtual Host Manager Page, you can add virtual hosts to serve your application from. To access Host Manager choose “Host Manager” in the Main Page of Tomcat.

tomcat host manager

Type Username and Password that we given at step 4

tomcat host manager

After doing authentication you will be see Tomcat Virtual Host Manager Page will look like that

tomcat host manager

That’s it, This is all about Installation of Tomcat on Centos 7 / RHEL 7 (Linux). You can now deploy your own Java Application. If you want to ask any question about this Tutorial comment Below and always Remember to stay connected with the for Latest updates about the Linux.


Please enter your comment!
Please enter your name here