How to install Apache Tomcat 9 on CentOS 7

Filed Under: Java

Formerly known as Jakarta Tomcat, Apache Tomcat is a free and open-source web server that was founded by Apache Foundation. Unlike traditional web servers such as Apache or Nginx, Apache Tomcat is used to serve Java-based web applications. Tomcat version 9 was released on December 6th, 2018. Some of the improvements include Support for Java Servlet 3.1, Java WebSocket 1.0 and JavaServer Pages 2.3 to mention just but a few. In this guide, we are going to discuss how to install Apache Tomcat 9 on CentOS 7.

Step 1: Install and configure Java

Before proceeding to install Apache Tomcat 9, ensure that the Java is installed. To install Java 8, run the below command.

# yum install java-1.8.0-openjdk-devel

Sample Output

Install Java JDK

Once successfully installed, you can verify its version by running the command.

# java -version

Sample Output

Check Java Version

Step 2: Install Apache Tomcat 9

After successful installation of Java, now its time to install the latest version of Tomcat. By the time of writing this guide, the latest version of Tomcat is Tomcat 9.0.2. To get the latest version, head out to Tomcat’s official page .

To get started with installing Tomcat 9, navigate to /usr/local directory as shown.

# cd /usr/local

Next download the latest Tomcat tarball file using wget command.

# wget

Sample Output

Download and install Tomcat 9

Extract the tarball file.

# tar -xvf apache-tomcat-9.0.20.tar.gz

Sample Output

Extract Apache Tomcat Tarball

Once you have extracted the tarball, you will have 2 files as shown.

After Extracting Apache Tomcat 9

For simplicity’s sake, rename the extracted folder to the latest Tomcat version, in this case tomcat9

# mv apache-tomcat-9.0.20 tomcat9

Next, configure CATALINA_HOME environment variable as shown.

# echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc
# source ~/.bashrc 

Sample Output

Set Environment Variables

At this point, we are now set to launch Apache Tomcat 9. Run the following commands to start Tomcat 9.

# cd /usr/local/tomcat9/bin
# ./ 

Sample Output

Start Tomcat

To access the Tomcat server, open your web browser and browse your server’s IP.


Apache Tomcat 9

Step 3: Setting up Tomcat 9 accounts

At this stage, you can only access Tomcat’s default web page. To access the Server Status, Host Manager, and Manager App we need to configure user accounts for managers and admins. These settings are found in tomcat-users.xml file.

Open the file using the full file path as shown.

# vim /usr/local/tomcat9/conf/tomcat-users.xml

To add a user spikey with password Jupiter2030! with the role of manager-gui append the following lines.

<role rolename="manager-gui">
<user username=""spikey" password="Jupiter2030!" roles="manager-gui">

Alternatively, you can add an admin user called admin with admin-gui role and with a password Magnum2030!.

Adding Users In Tomcat

Finally, restart Tomcat and try accessing the Manager section. When asked for authentication, provide the credentials created in the above steps.



Apache Tomcat is the most popular web server for Java web applications and web services. We can install it easily on any server and run our Java applications.


  1. aayush says:

    I guess url to wget tomcat is expired

  2. Vladimir says:

    Thanks a lot for this article!

Comments are closed.

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors