This tutorial will help you to how to install Apache Tomcat 10 on Ubuntu 20.04 LTS Linux systems.

Prerequisites

A running Ubuntu 20.04 system with shell access of root or sudo privileged account access. For the newly installed systems recommended to complete initial server setup instructions.

Step 1 – Install Java

You must have JRE (Java runtime environment) installed on your system. Tomcat 10 is required to have JRE 8 or higher version installed on your system. Use the following command to install OpenJDK to fulfil the requirements. Check the current active Java version:

Step 2 – Create Tomcat User

We recommended running a Tomcat server with a dedicated user account. Create a new user, which is recommended for security purposes mainly for production deployments. To create a new account, type: The above command will create a user and group with the name “tomcat” in your system.

Step 3 – Install Tomcat 10

The Apache Tomcat development team releases the latest version of Tomcat from time to time. So it will be good check download latest Tomcat version from the official download server. Use the below command to download Tomcat 10. Once the download is completed, extracted the downloaded archive and copy all content to the tomcat home directory. Next, set the proper file permissions. You have now the latest Tomcat application on your system.

Step 4 – Create Tomcat User

Now, configure your tomcat with user accounts to secure access of admin/manager pages. To do this, edit conf/tomcat-users.xml file in your editor and paste the following code inside tags. We recommend changing the password in the below configuration with high secured password. Add the following values. Make sure to change the password for admin and manager access. Save file and close.

Step 5 – Enable Remote Tomcat Access

The default Tomcat manager and host-manager applications are accessible for localhost only. To allow access to these pages from the remote system, you need to modify the following configuration files. You can either allow a specific remote system or allow all. Edit the context.xml file for manager and host manager application: Comment out the section added for IP address restriction to allow connections from anywhere. Similarly edit context.xml for host manager application in text editor: Comment out the same section to allow connections from anywhere. Save all files and close it.

Step 6 – Create a Tomcat Systemd Unit File

Tomcat provides bash scripts to start, stop service. But, to make it simple, create a startup script to manage Tomcat as systemd service. Let’s create a tomcat.service file with the following content: Reload the systemd daemon service to load newly create files. Now, start the Tomcat application for the first time. Next, enable the tomcat service to auto-start for subsequent system boots. This is more important for the production deployments. As of now, the tomcat application is running on your system. You can verify the service status by executing the command as below. Make sure the status is showing “active (running)“.

Step 7 – Access the Tomcat Web Interface

The default Tomcat server runs on port 8080. As you have configured Tomcat on your system, you can access web interface from your system. You can access tomcat interfaces by entering your server’s IP address or a domain name pointed to that server, followed by port 8080 in your browser: Change tecadmin.local with your server ip or domain or localhost. You will see the page like below:

Tomcat Manager App is a web application packaged with the Tomcat server application. The Manager interface provides us with the basic functionality we need to manage our deployed web applications. Click Manager App button home page or directly type /manager in browser url of main Tomcat server to access it.

Tomcat Host Manager App is another web application packaged with Tomcat server application. Which is used to creates/removes Virtual Hosts within the Tomcat service. A Virtual Host allows you to define multiple hostnames on a single server. Click Host Manager button home page or directly type /host-manager url in main Tomcat server to access it.

Conclusion

You have a running Tomcat server on Ubuntu system. You may need to create a Virtual host or configure a SSL certificate in Tomcat.

How to Install Tomcat 10 on Ubuntu 20 04   TecAdmin - 90How to Install Tomcat 10 on Ubuntu 20 04   TecAdmin - 58How to Install Tomcat 10 on Ubuntu 20 04   TecAdmin - 94