How To

Install Tomcat 10 on Ubuntu 22.04 Easily

Apache Tomcat remains one of the most trusted platforms for running Java-based web applications. If you want to deploy enterprise apps, APIs, or servlet-based projects, learning how to Install Tomcat 10 on Ubuntu 22.04 is an essential skill. Fortunately, the setup process is straightforward and works well for both testing and production environments.

Tomcat 10 delivers improved Jakarta EE support, better performance, and enhanced stability. In this guide, you will learn how to install Java, configure Tomcat as a service, enable firewall access, and secure the management dashboard.

Why Install Tomcat 10 on Ubuntu

Many developers prefer Tomcat because it is lightweight, reliable, and easy to maintain. In addition, Ubuntu 22.04 provides long-term support, making it a solid platform for Java applications.

Tomcat works perfectly for:

  • Java servlet applications
  • Enterprise web platforms
  • REST APIs
  • Development and testing servers
  • Spring-based applications

Before you begin, ensure your Ubuntu server has sudo privileges.

Install Tomcat 10 Dependencies

Tomcat requires Java 11 or later. First, update the package repository and install OpenJDK:

sudo apt update
sudo apt install openjdk-11-jdk

Next, verify the Java installation:

java -version

After that, create a dedicated Tomcat user for improved security:

sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat

Using a separate service account helps reduce security risks and keeps permissions organized.

Download and Install Tomcat 10

To Install Tomcat 10, download the latest Tomcat archive from the official Apache mirrors:

VERSION=10.1.4
wget https://downloads.apache.org/tomcat/tomcat-10/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz -P /tmp

Now extract the package:

sudo tar -xf /tmp/apache-tomcat-${VERSION}.tar.gz -C /opt/tomcat/

Create a symbolic link for easier upgrades later:

sudo ln -s /opt/tomcat/apache-tomcat-${VERSION} /opt/tomcat/latest

Then assign the correct ownership:

sudo chown -R tomcat: /opt/tomcat
sudo chmod +x /opt/tomcat/latest/bin/*.sh

At this stage, Tomcat files are ready for configuration.

Configure Tomcat 10 Service

Instead of launching Tomcat manually every time, configure it as a systemd service.

Create a new service file:

sudo nano /etc/systemd/system/tomcat.service

Add the required Tomcat and Java environment variables, then save the file.

Afterward, reload systemd and start Tomcat:

sudo systemctl daemon-reload
sudo systemctl enable --now tomcat

Check whether the service is running correctly:

sudo systemctl status tomcat

If everything works properly, Ubuntu will display an active Tomcat service status.

Secure and Access Tomcat 10

To access Tomcat remotely, open port 8080 through the firewall:

sudo ufw allow 8080/tcp

Then open your browser and visit:

http://YOUR_SERVER_IP:8080

You should now see the Tomcat welcome page.

For better security, create administrative users inside the tomcat-users.xml file. Additionally, restrict remote dashboard access whenever possible. Production servers should never expose management panels publicly without proper protection.

Conclusion

Now you know how to Install Tomcat 10 on Ubuntu 22.04 and configure it for Java application hosting. With Java installed, firewall rules configured, and systemd integration enabled, your server is ready for development or deployment tasks.

Tomcat remains a reliable choice for modern Java workloads because it offers flexibility, stability, and simple management on Ubuntu systems.

Cyber Defence

Recent Posts

Bash Scripting Best Practices Every Beginner Should Know

Introduction Bash scripting is a powerful way to automate Linux tasks, but writing a script…

1 day ago

How To Create A Self-Signed SSL Certificate Using Bash And OpenSSL

Introduction A self-signed SSL certificate is a certificate that is created and signed by the…

1 day ago

How To Debug Bash Scripts Using bash -x And set Commands

Introduction Debugging is an important part of Bash scripting. When a script does not work…

1 day ago

How To Use Cron Jobs With Bash Scripts For Automation

Introduction Cron jobs are used in Linux to run commands or Bash scripts automatically at…

1 day ago

How To Use Pipes In Bash Scripts For Command Chaining

Introduction Pipes are an important feature in Linux and Bash scripting. A pipe allows you…

1 day ago

How To Use grep, awk, And sed In Bash Scripts

Introduction The grep, awk, and sed commands are powerful text-processing tools in Linux. They are…

1 day ago