How to Install Apache Tomcat 9 on Ubuntu Step By Step


Tomcat is a java Servlet container and web server from the Apache software foundation .Tomcat can be used as standalone or it can be used behind traditional web servers such as Apache httpd servers . a web servers uses the request / response message exchange pattern to server web pages.


  • Ubuntu 18.04 – 64bit
  • 2 GB or more memory (Recommended)
  • Root Privileges

Step 1– Java Installation

You must have Java installed on the system before installing ApacheTomcat on a Linux VPS

# java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

If you do not installed Java on your system or installed a lower version then you use this command-

$ sudo apt-get update
$ sudo apt-get install default-jdk

Step 2 – Download & Install ApacheTomcat 9

$ wget
$ tar xzf apache-tomcat-9.0.19.tar.gz
$ sudo mv apache-tomcat-9.0.19 /usr/local/apache-tomcat9

Step 3 – Configure Environment Variables

Now you configure the required environment variables for the Tomcat. And Set CATALINA_HOME.

$ echo "export CATALINA_HOME="/usr/local/apache-tomcat9"" >> ~/.bashrc
$ echo "export JAVA_HOME="/usr/lib/jvm/java-11-oracle"" >> ~/.bashrc
$ echo "export JRE_HOME="/usr/lib/jvm/java-11-oracle"" >> ~/.bashrc
$ source ~/.bashrc

Step 4 – Setup Apachetomcat User Accounts –

Now You need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file and paste inside <tomcat-users> </tomcat-users> tags.

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

Step 5 – Enable Host/Manager for Remote IP

The default manager and host-manager both web pages are enabled to access from localhost. To access pages from the remote system, you must need to  allow your IP in the application-specific context.xml file.

Default Manager File: ./webapps/manager/META-INF/context.xml

Host Manager File: ./webapps/host-manager/META-INF/context.xml

Step 6 – Starting Tomcatapche Service

Now tomcat start, and There is no need to compile its source. You simply extract the archive and start the tomcat server. Tomcat by

default start on port 8080, So it is nessary that no other application using the same port.

$cd /usr/local/apache-tomcat9
$chmod +x ./bin/
$ ./bin/


All Done Enjoy 🙂

Also Read:-

4 thoughts on “How to Install Apache Tomcat 9 on Ubuntu Step By Step

Leave a Reply

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