How To Install Apache Tomcat on Ubuntu 18.04 LTS

Install Apache Tomcat on Ubuntu 18.04 LTS

In this tutorial we will show you how to install Apache Tomcat on Ubuntu 18.04 LTS. For those of you who didn’t know, Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation. It implements the Java Servlet, JavaServer Pages (JSP), Java Unified Expression Language and Java WebSocket specifications from Sun Microsystems and provides a web server environment for Java code to run in.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Apache Tomcat 9 on a Ubuntu 18.04 (Bionic Beaver) server.

Install Apache Tomcat on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

Step 2. Installing Java.

Apache Tomcat requires Java to be installed on your server. By default, Java is not available in Ubuntu’s repository. Add the Oracle Java PPA to Apt with the following command:

Verify the Java version by running the following command:

Step 2. Installing Apache Tomcat on Ubuntu 18.04 LTS.

First thing to do is to go to Apache Tomcat’s download page and download the latest stable version of Apache Tomcat, At the moment of writing this article it is version 9:

Next, Create a directory for Tomcat files:

Then give the user control of the directory:

Step 3. Configure Apache Tomcat.

Configure Tomcat users so they can access admin/manager sections. You can do this by adding the users in the conf/tomcat-users.xml file with your favorite text editor. Add this text to the file:

Place the following two lines just above the last line.

Next, run the commands below to create a server account for Tomcat:

Add lines below into the file and save:

Save and exit and reload the systemd service:

You can verify the service running, by default tomcat runs on port no 8080.

Step 4. Accessing Apache Tomcat.

Tomcat server default works on port 8080. Access tomcat in the web browser by connecting your server on port 8080. If you are using a firewall, please open port 80 to enable access to the control panel:

Install Apache Tomcat on Ubuntu 18.04

Congratulation’s! You have successfully installed Apache Tomcat. Thanks for using this tutorial for installing Apache Tomcat 9 in Ubuntu 18.04 LTS system. For additional help or useful information, we recommend you to check the official Apache Tomcat web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!