Install Tomcat 9 on an Ubuntu 16.04 VPS

Apache Tomcat (previously known as Jakarta Tomcat) or simply Tomcat, is an open source web server and servlet container developed by the Apache Software Foundation. It executes Java servlets and renders Web pages that include Java Server Page coding and it is one of the most popular web servers used by the java developers.
In this article we will install the latest release of Tomcat 9 server on an Ubuntu 16.04 VPS. This tutorial should work on other Debian based systems as well but was tested and written for Ubuntu 16.04
First of all login to your Ubuntu 16.04 VPS via SSH as user root

ssh root@IP_address

and start a new screen session

screen -U -S tomcat9

To update all packages installed on your server run the following command in the terminal

apt-get update && apt-get upgrade

In order to run Tomcat server, Java has to be installed on the VPS. Execute the following command to install the Java Development Kit package (JDK)

apt-get install default-jdk

After the installation is completed, You can check the Java installed on your server using the command below

java -version

If you receive an output similar to the one above, the installation is successful.

Once Java is installed on the server, we will proceed installing Tomcat 9.

For security reasons it is not recommended to run Tomcat as user root, so we will create a new system user

useradd -r tomcat9 --shell /bin/false

Change the current working directory to /opt and download the latest Tomcat 9 release to the /opt directory on your server. At the moment of writing this tutorial Tomcat version 9.0.0.M6 is the latest one. You should go to Tomcat’s official website and check if a newer version is available.

Finally, if you closely followed the instructions in this tutorial you will be able to access Tomcat by navigating your favorite web browser to http://your_server_IP:8080

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Tomcat 9 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.