How To Install Apache Tomcat 8 on Ubuntu 16.04

Install Apache Tomcat 8 on Ubuntu 16.04

In this tutorial we will show you how to install and configuration of Apache Tomcat 8 on your Ubuntu 16.04 server. 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.


Install Apache Tomcat 8 on Ubuntu 16.04

Step 1. Installing Java (JRE or JDK).

Once you have verified if Java is installed or not, choose the type of Java installation that you want with one the following:

Another alternative Java install is with Oracle JRE and JDK. However, we would need to install additional repositories for a proper installation:


Verify Installed Java Version.


Setup JAVA_HOME on Ubuntu 16.04.

Since many programs now days need a JAVA_HOME environment variable to work properly. We will need to find the appropriate path to make these changes. With the following command, you can view your installs and their path:

Now that you are in the user profile file, add the following code, along with the Path of your installation from the previous step, to the bottom. ( Example: JAVA_HOME=”YOUR_PATH”):

Reload the file so all your changes could take effect with the following command:

Verify that your implementations are correct with the following command:

Step 2. Installing Apache Tomcat.


Add tomcat user and group:

Step 3. Configure environment variables.

Before starting Tomcat, configure CATALINA_HOME environment variable in your system using following commands.

Step 4. Configure Tomcat to run as a service.

You will get the following output.

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

Step 5. Finally, open Tomcat from your browser, go to your IP or domain with the 8080 port (because Tomcat will always run on the 8080 port) as an example:, replace with your IP or domain.

To shutdown Tomcat you can simply run the shutdown script in the same folder like this:

Step 6. Setup user accounts.

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.

Save and close the file when you are finished. To put our changes into effect, restart the Tomcat service:

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

VPS Manage Service Offer