Install Tomcat in Ubuntu 16.04 [5 Easy Steps] – Beginner Tutorial

Install Tomcat in Ubuntu 16.04 [5 Easy Steps] – Beginner Tutorial

Introduction

Here in his tutorial, let us see how to install Tomcat in Ubuntu 16.04 server.

What is Apache Tomcat?

Apache Tomcat is a web server developed by Apache foundation. This is also open source web server and Servlet container.

The Tomcat supports java EE specifications.

Requirements

  • Configure your server according to this Ubuntu initial server setup tutorial.

Install Java on Ubuntu 16.04

We are not going very deep in installing java in this tutorial. You can check this install Java Ubuntu detailed tutorial.

Follow this simple commands to install Java on Ubuntu 16.04 server.

First, update the server repository index.

Then, install java using this simple command.

After that, we have to create a Tom Cat user to run tomcat service.

Install Tomcat on Ubuntu

To install the latest version of Tomcat on Ubuntu server, we have to download the Latest release from the tomcat page itself.

Now, switch to tmp directory and download the file. The tmp directory is used to download the zipped file and we will remove the zip file after installing the extracted software.

Then, use the curl command to download the file from tomcat website.

Tomcat will be installed on /opt/tomcat location. First create the file and extract the file to the /opt/tomcat using the below command.

After that, we have to setup the permission for the Tomcat

Permission Configuration

Move to the tomcat folder using the below command.

Now, it’s time to give group ownership to the tomcat for the file so that it can read and write.

To enable read access, use the below command.

Then, you have to make the tomcat owner for the work, temp, logs and webapps directories.

Thats all. You have setup all the required permission for the tomcat. Now, let us create the Systemd file for tomcat.

Systemd File Creation for Tomcat

In order for the tomcat to run as a service, we need to create the systemd file.

First, we have to find the Java installation location. The Java installation location is called as “Java_Home”. 

To find Java Home, use the below command.

You will get output similar to this.

For your server, the java home might be different. Make sure to run the above command to fine the location.

After that, Open the Tomcat Systemd file using the below command.

The file will open and you have to make changes in the Java Home Value to match up with your system java installation location.

After that, save and close the file.

Then, start the tomcat service using the below command.

Now, you can ensure the status of the service by executing the below command.

Tomcat Web Management Interface

Tomcat has the manager web app. We have to create login access to use the web app. To do that, follow the below step. First, we will edit tomcat-users.xml file.

After that, we have to create user which can access the manager-gui and admin gui. You can do that by using below configuration.

Then, save and close the file.

The current version of Tomcat, restrict the access to the manager and host manager app from the local system itself.

remember, we need to access tomcat manager from remote server. We will remove the restriction by Configuring the IP connection.

We will do this by making changes in context.xml file.

You can open manage app xml file using the below command.

Then, you can open the host manager app xml file using the below command.

Now, you have to comment out the IP address restriction using the below command.

The above changes will let you access tomcat manager from anywhere.

Now, save and close the file. Then, restart the tomcat using the below command.

Testing the Tomcat Installation

Now, it’s time to test what we have done.

To access the Apache web management interface, visit the below address in browser

To look Tomcat manage app, visit here.

To check the host manage app, visit the below link

Conclusion

If you can see the concerned pages, then, you have installed the Tomcat successfully.

If you have any questions, let us know that in command. Also, make sure to subscribe for the upcoming tutorials. Learn cloud with Serverclear.com

 

 

Leave a Reply

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