Learn how to install Tomcat and some of the cloud hosting option to deploy your Tomcat applications.

There are two parts to this blogpost – the first part talks about how to install Apache Tomcat on Ubuntu by yourself, and the second part talks about the best hosting platforms available to host Tomcat applications.

What is Apache Tomcat?

Apache Tomcat is an open-source web/application server from the Apache foundation. It was formerly called Jakarta. It is an HTTP server and a servlet container. By default, it runs on port 8080.

Tomcat implements the java servlets and the Java server pages specifications. It provides a Java web server environment for Java code to run in. Apache Tomcat includes configuration and management tools. It can also be configured directly by editing the XML configuration file.

Here is a step by step guide to install Tomcat 9 on Ubuntu 18.04.


To install Tomcat, you need to have java installed on your system.

Update the repository and install Java 8.

sudo apt-get update
sudo apt-get install openjdk-8-jdk -y

Choose Java 8 you just installed as the current Java version.

sudo update-alternatives --config java

Check the Java version.

[email protected]:~$ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.10.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

Install Tomcat 9

Download the latest package of Tomcat 9 version, currently its tomcat-9.0.27. You can always refer to the official download link for the latest version.


The below example is for 9.0.27.

  • Download the Tomcat package
[email protected]:~$ wget http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
--2019-11-18 14:29:04-- http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
Resolving www-eu.apache.org (www-eu.apache.org)..., 2a01:4f9:2a:185f::2
Connecting to www-eu.apache.org (www-eu.apache.org)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10982406 (10M) [application/x-gzip]
Saving to: ‘apache-tomcat-9.0.27.tar.gz’

apache-tomcat-9.0.27.tar.gz 100%[=================================================================>] 10.47M 3.87MB/s in 2.7s

2019-11-18 14:29:38 (3.87 MB/s) - ‘apache-tomcat-9.0.27.tar.gz’ saved [10982406/10982406]
  • Extract the Tomcat 9 package
[email protected]:~$ tar -xzf apache-tomcat-9.0.27.tar.gz
  • For security reasons, we will create a separate system user for Tomcat.
[email protected]:~$ sudo useradd -r -m -U -d /home/geekflare/apache-tomcat-9.0.27 -s /bin/false tomcat
[sudo] password for geekflare:
  • The tomcat user should have complete access to the Tomcat installation directory. This command changes the installation directory ownership to the tomcat user.
[email protected]:~$ sudo chown -RH tomcat: apache-tomcat-9.0.27
  • All the scripts inside the bin directory of tomcat must be executable, so add the executable permission.
[email protected]:~$ sudo sh -c 'chmod +x apache-tomcat-9.0.27/bin/*.sh'
  • Create a file tomcat.service inside /etc/systemd/system/ to run tomcat as a service.

Wondering why? well, this is to ensure Tomcat starts automatically when server reboot.

[email protected]:~$ sudo gedit /etc/systemd/system/tomcat.service
  • Copy-paste the content below in the file. Change the JAVA_HOME path according to your java installation path.

Description=Tomcat 9 servlet container







Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"




Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"




  • Run the below command to tell the system about the new service file you just created.
[email protected]:~$ sudo systemctl daemon-reload
  • Start the tomcat service.
[email protected]:~$ sudo systemctl start tomcat
  • Check if the tomcat service is in the running mode or not.
[email protected]:~$ systemctl status tomcat.service
● tomcat.service - Tomcat 9 servlet container
Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2019-11-18 14:41:12 EST; 4s ago
Process: 22939 ExecStart=/home/geekflare/apache-tomcat-9.0.27/bin/startup.sh (code=exited, status=0/SUCCESS)
Main PID: 22947 (java)
Tasks: 14 (limit: 4680)
Memory: 63.0M
CGroup: /system.slice/tomcat.service
└─22947 /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Djava.util.logging.config.file=/home/geekflare/apache-tomcat-9.0.27/conf/logg

Nov 18 14:41:12 geekflare systemd[1]: Starting Tomcat 9 servlet container...
Nov 18 14:41:12 geekflare systemd[1]: Started Tomcat 9 servlet container.
  • You can ask the system to automatically start tomcat at boot time by running the command below.
[email protected]:~$ sudo systemctl enable tomcat
Created symlink /etc/systemd/system/multi-user.target.wants/tomcat.service → /etc/systemd/system/tomcat.service.
  • Make sure your firewall does not stop Tomcat from running. Open port 8080 on which tomcat runs.
[email protected]:~$ sudo ufw allow 8080/tcp
Rules updated
Rules updated (v6)
  • Edit the tomcat-users.xml file where all the users and roles are defined for the tomcat web management interface.
[email protected]:~$ sudo gedit apache-tomcat-9.0.27/conf/tomcat-users.xml
  • I am giving a tomcat user manager-gui role also, which allows it to access the web management interface with a different credential.
<?xml version="1.0" encoding="UTF-8"?>


Licensed to the Apache Software Foundation (ASF) under one or more

contributor license agreements. See the NOTICE file distributed with

this work for additional information regarding copyright ownership.

The ASF licenses this file to You under the Apache License, Version 2.0

(the "License"); you may not use this file except in compliance with

the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,


See the License for the specific language governing permissions and

limitations under the License.


<tomcat-users xmlns="http://tomcat.apache.org/xml"


xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"



NOTE: By default, no user is included in the "manager-gui" role required

to operate the "/manager/html" web application. If you wish to use this app,

You must define such a user - the username and password are arbitrary. It is

strongly recommended that you do NOT use one of the users in the commented out

the section below since they are intended for use with the examples web




NOTE: The sample user and role entries below are intended for use with the

examples web application. They are wrapped in a comment and thus are ignored

when reading this file. If you wish to configure these users for use with the

examples web application, do not forget to remove the <!.. ..> that surrounds

them. You will also need to set the passwords to something appropriate.




<role rolename="tomcat"/>

<role rolename="manager-gui"/>

<user username="tomcat" password="tomcat" roles="tomcat"/>

<user username="tomcat" password="admin" roles="manager-gui"/>

tomcat web ui

  • Now go to http://localhost:8080/manager/html, where the web dashboard of tomcat is present. You will be asked to log in, use username tomcat and password admin to login. Using this interface, you can start, stop, reload, deploy an application with a click of a button.

tomcat web application manager

Congratulations! You have successfully installed Tomcat 9 on Ubuntu 18.04.

Now the second part about the hosting platforms and their features.

A2 Hosting

A2 hosting platform claims its Tomcat hosting to be the fastest, easiest, and most reliable. On A2, you can run 20X faster using A2’s Turbo boost VPS.

They offer 24×7 support with any hosting issue you come across on their platform with a 99.9% uptime guarantee. That makes A2 a very reliable hosting platform.

It gives you enough options to customize the resources you need on the platform. A2 is developer-friendly and gives you the root access to all server’s files, which you are free to edit as per your need. There is a risk-free Anytime Money Back Guarantee in case you do not like the hosting platform and want to stop the usage.


Kamatera is a popular cloud hosting platform. It helps you set up, configure, and launch tomcat in seconds. You can choose the tomcat version you want to host and also the zone (region) where you want to host from a straightforward user interface.

Pricing is very attractive.

You can get it started from as low as $4 per month.

Depending on the configuration you choose, there is a wide range of pricing options offered by Kamatera. You can choose from a monthly pricing option or even hourly pricing option. The best part is the first 30 days are entirely free.


Jelastic offers a multi-cloud configuration where applications can be hosted on different clouds for extra high availability. It provides a combination of PaaS (Platform as a Service) and CaaS (Container as a Service) models.

With its simple user interface, you can easily select the tomcat application its version and launch it with just a click in a few seconds.

jelastic - tomcat

Automatic Tomcat Clustering in Jelastic offers a high availability feature. So, if any tomcat instance fails, another instance gets started automatically. Your tomcat cluster can automatically scale vertically in Jelastic, and it also gives you manual options to scale your cluster horizontally.

Few other features that Jelastic offers are:

  • Support for microservices and legacy applications
  • Integrated CI and CD tools for automation
  • Built-in monitoring system with alert notification
  • Integrated IDE Plugins: IntelliJ IDEA, Eclipse, NetBeans
  • Sharing environment and account collaboration with different access levels
  • Marketplace with a rich set of preconfigured applications for one-click installation


Another hosting platform is Java Hosting Service for Tomcat. It contains built-in plugins for hibernate, Spring MVC, Servlets and JSPs, Grails, Play, and many more.

With JavaPipe, you can start with as low as $ 5.40 per month, which gives you dedicated Tomcat instance versions 7, 8, or 9 with JDK 7, 8, 10, or 11 support. It gives you 128 MB to 2 GB dedicated RAM and unlimited access to MariaDB. You also get 200 GB of monthly traffic and 5 GB of SSD storage. There are other pricing options also with Java Hosting platform offering more monthly traffic and SSD storage.

Also, you get 40% off if you pay for three years. So, if can think of a long term hosting plan, this could be beneficial

java hosting - tomcat


That was all about Tomcat installation and hosting platforms. If you are interested in hosting Tomcat yourself but on the cloud, then check out these platforms.