How to Install and Setup Apache Tomcat 8 on CentOS 7 / RHEL 7

What is Tomcat Server and What is Apache Tomcat used for ?

Apache Tomcat version 8 is an open source web server and servlet container developed by the Apache Software Foundation (ASF).

It provides a web server environment for Java based source code and used to deploy Java Servlets and JSPs.

Basically Apache is an HTTP Server, serving HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.

Tomcat 8 is the first Apache Tomcat release to support the Servlet 3.1, JSP 2.3, EL 2.3, and WebSocket specifications.

This article will describes how to install and configure Tomcat 8 on CentOS 7, RHEL 7 and Oracle Linux 7.

1. Install Oracle java :

READ  How to Properly Reboot Linux CentOS/RHEL Server

2. How to download Apache Tomcat 8 :

To download Apache tomcat 8, go to the apache tomcat mirror

# cd /opt
# wget

3. Extract the downloaded files :

# tar xzvf apache-tomcat-8.0.22.tar.gz

4. Create tomcat8 group and add user tomcat8 to that group:

# groupadd tomcat8
# useradd -s /bin/bash -g tomcat8 tomcat8

5. Create a symbolic link of tomcat directory to /opt/tomcat and assign permission :

# ln -s /opt/apache-tomcat-8.0.22 /opt/tomcat
# chown -R tomcat8:tomcat8 /opt/tomcat /opt/apache-tomcat-8.0.22

6. Create a Systemd Setting file :

# vi /usr/lib/systemd/system/tomcat8.service

Add the following :

Description=Apache Tomcat 8



7. How to start tomcat server and make it auto start at boot :

# systemctl start tomcat8
# systemctl enable tomcat8

8. Tomcat server works on port 8080 default. You can access from your browser using the url :

READ  How to Install Webmin on CentOS 7/RHEL 7/Oracle Linux 7



9. There are changes on the user roles on Tomcat 8. By default, no users or passwords are created for the Tomcat manager roles. To set roles, user name(s) and password(s), we need to configure the tomcat-users.xml file located at $CATALINA_HOME/conf/tomcat-users.xml.

# vi /opt/tomcat/conf/tomcat-users.xml

Add the following :

<!-- user manager can access only manager section -->
<role rolename="manager-gui"></role>
<user username="manager" password="password" roles="manager-gui"></user>

<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui"></role>
<user username="admin" password="password" roles="manager-gui,admin-gui"></user>

Read here on the different between Apache Web Server and Apache Tomcat server.

10 comments on “How to Install and Setup Apache Tomcat 8 on CentOS 7 / RHEL 7

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>