Do you want to control your Java apps from a user-friendly web application? Look no further than Tomcat. Find out how to easily install this powerful app server on Ubuntu Linux.
Apache Tomcat has been around for a while and continues to be one of the more popular app server and servlet containers available. This is an open source implementation of various technologies of the Jarkarta EE platform and can be used by anyone for free. Apache Tomcat provides session replication, clustering, and JMX-based server monitoring and control.
SEE: Rental Kit: Back-end Developer (Tech Republic Premium)
If you are looking for a Java app server, Apache Tomcat is what you are looking for. I’m going to show you how easy it is to install Apache Tomcat on Ubuntu Server.
What you need to install Apache Tomcat
All you need for this installation is a running instance of Ubuntu Server 20.04 or 22.04 and a user with sudo privileges. That’s it: let’s get to work.
Install Java
The first thing we need to do is install Java, specifically OpenJDK 11. To do that, log into your Ubuntu instance and issue the command:
sudo apt-get install openjdk-11-jdk -y
Once the installation is complete, verify it with the command:
java --version
You should see something like this in the output:
openjdk 11.0.17 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu222.04, mixed mode, sharing)
How to Install Apache Tomcat
Fortunately, a version of Apache Tomcat has been found in the standard repositories. You can find out exactly which version by issuing the command:
sudo apt-cache search tomcat
The output should show that version tomcat9 is available, which is what we’ll be installing. To install version 9 of Apache Tomcat, issue the command:
sudo apt-get install tomcat9 tomcat9-admin -y
You now want to open port 8080 in your firewall with the command:
sudo ufw allow from any to any port 8080 proto tcp
How to Configure Apache Tomcat
We now need to configure Apache Tomcat so that you can log in to the web GUI with the correct permissions to use the administrative tools. Open the configuration file with:
sudo nano /etc/tomcat9/tomcat-users.xml
In that file, you’ll see a section at the bottom that looks like this:
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<changeme>" roles="tomcat"/>
<user username="both" password="<changeme>" roles="tomcat,role1"/>
<user username="role1" password="<changeme>" roles="role1"/>
-->
Change that section to this, where PASSWORD is a strong and unique password:
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="PASSWORD" roles="manager-gui"/>
<user username="both" password="PASSWORD" roles="tomcat,role1"/>
<user username="role1" password="PASSWORD" roles="role1"/>
Save the file and close it.
Restart Apache Tomcat with:
sudo systemctl restart tomcat9
Access the web GUI
Open a web browser and point it to http://SERVER:8080/manager/html, where SERVER is the IP address or domain of the hosting server. You will be prompted for user credentials. Type tomcat for the username and password you created in the tomcat-users.xml file. Upon successful authentication, you will be greeted by the Tomcat Web Application Manager (Image A).
Image A

Everything is possible
With Apache Tomcat installed, the sky is the limit as to what you can do with your Java apps. By using this handy web-based GUI, you can easily start deploying your Java apps.
Subscribe to TechRepublic’s How to make technology work on YouTube for all the latest technical advice for business professionals from Jack Wallen.