How to Install Tomcat 10 on Ubuntu 24.04 LTS: Complete Guide
Learn how to install tomcat 10 on ubuntu 24.04 LTS with OpenJDK 21, systemd service setup, user authentication, web manager GUI, and UFW firewall rules.

5 min read
Learn how to install tomcat 10 on ubuntu 24.04 LTS with OpenJDK 21, systemd service setup, user authentication, web manager GUI, and UFW firewall rules.
- Prerequisites and Supported Releases
- Step 1: Installing OpenJDK 21 LTS Java Runtime
- Step 2: Creating a Dedicated Tomcat System User and Group
Apache Tomcat is an open-source implementation of the Jakarta Servlet, Jakarta Pages, Jakarta Expression Language, and Jakarta WebSocket technologies.
Powering mission-critical Java web applications across global enterprises, Tomcat 10 represents a major evolutionary milestone by adopting the jakarta.* package namespace in alignment with Jakarta EE 9 and EE 10 specifications.
Ubuntu 24.04 LTS provides an ideal production host for Tomcat 10, delivering long-term security support, modern OpenJDK 21 Java runtimes, and systemd service management.
In this comprehensive tutorial, we walk through how to install tomcat 10 on ubuntu 24.04 LTS from official tarballs, configure a secure systemd service, configure user roles, and open firewall ports.
Complete step-by-step administrator and Java developer tutorial on how to install and configure Apache Tomcat 10 on Ubuntu 24.04 LTS (Noble Numbat). Explains installing OpenJDK 21 LTS, creating a dedicated unprivileged tomcat system user, downloading and verifying the latest Tomcat 10 binary tarball, configuring a robust systemd service unit, managing administrative user roles in tomcat-users.xml, adjusting remote IP address filters for the Web Application Manager, and configuring UFW firewall rules.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat) & Ubuntu 22.04 LTS. The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A server or computer running Ubuntu 24.04 LTS or Ubuntu 22.04 LTS.
- A non-root user account with
sudoadministrative privileges. - At least 2 GB of RAM and 10 GB of free storage.
- Access to a command-line terminal shell.
Step 1: Installing OpenJDK 21 LTS Java Runtime
Apache Tomcat 10 requires Java SE 11 or newer to operate.
On Ubuntu 24.04, OpenJDK 21 is the default Long-Term Support Java release.
Update your local package index and install the headless OpenJDK 21 development package:
# Update APT package lists:
sudo apt update
# Install OpenJDK 21 headless runtime and development tools:
sudo apt install -y openjdk-21-jdk-headless
# Verify installed Java version:
java -version
# Expected output confirms:
# openjdk version "21.0.3" (or newer) LTS
# OpenJDK Runtime Environment (build 21.0.3+9-Ubuntu...)
Step 2: Creating a Dedicated Tomcat System User and Group
Running Tomcat as the root administrative user is an extreme security risk.
Create a dedicated, unprivileged system user and group named tomcat with a home directory at /opt/tomcat and login shell disabled:
Execute the following user creation command:
# Create tomcat system group:
sudo groupadd tomcat
# Create tomcat system user with shell disabled:
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
Step 3: Downloading and Extracting Apache Tomcat 10
Download the latest stable release of Apache Tomcat 10 directly from Apache's official distribution mirrors.
Navigate to /tmp and download the core binary tarball (Tomcat 10.1.x):
Extract the archive into /opt/tomcat and configure proper file ownership:
# Download Tomcat 10.1.x binary release:
cd /tmp
wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.24/bin/apache-tomcat-10.1.24.tar.gz
# Create destination directory:
sudo mkdir -p /opt/tomcat
# Extract archive into /opt/tomcat stripping the parent folder:
sudo tar -xf apache-tomcat-10.1.24.tar.gz -C /opt/tomcat --strip-components=1
# Assign ownership to the tomcat user and group:
sudo chown -R tomcat:tomcat /opt/tomcat
sudo chmod -R u+x /opt/tomcat/bin
Step 4: Configuring Tomcat as a systemd Service
To allow Tomcat to start automatically on system boot and recover from crashes, create a systemd service unit file.
First, determine your system's exact Java home path using update-java-alternatives -l.
Create /etc/systemd/system/tomcat.service and define the service parameters:
# /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat 10 Web Application Container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseG1GC"
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
Enabling and Starting the Tomcat Service
Reload the systemd daemon to recognize the new unit file, then enable and start the Tomcat service:
Verify that Tomcat is active and listening on default port 8080:
# Reload systemd configuration:
sudo systemctl daemon-reload
# Enable Tomcat to start automatically on boot:
sudo systemctl enable tomcat
# Start Tomcat service:
sudo systemctl start tomcat
# Verify active service status:
sudo systemctl status tomcat
# Output confirms: Active: active (running)
Step 5: Configuring UFW Firewall for Tomcat Port 8080
By default, Tomcat listens for incoming HTTP traffic on port 8080.
If UFW is active on your Ubuntu server, permit incoming connections on port 8080:
Query UFW status to verify that the port rule is active:
# Allow incoming traffic on port 8080:
sudo ufw allow 8080/tcp
# Verify UFW firewall status:
sudo ufw status
# Output confirms: 8080/tcp ALLOW Anywhere
# Test HTTP response locally:
curl -I http://localhost:8080
# Output confirms: HTTP/1.1 200 OK
Step 6: Configuring Web Management Users and Remote IP Access
Tomcat includes two powerful administrative web applications: the Manager App (deploys and monitors WAR packages) and the Host Manager (manages virtual hosts).
Access to these apps requires configuring administrative user roles in /opt/tomcat/conf/tomcat-users.xml.
Add user credentials with manager-gui and admin-gui roles before the closing </tomcat-users> tag:
<!-- Add inside /opt/tomcat/conf/tomcat-users.xml -->
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="admin" password="YourSecurePassword123!" roles="manager-gui,admin-gui"/>
Enabling Remote IP Access for the Manager App
By default, Tomcat restricts access to the Manager App exclusively to the local machine (127.0.0.1).
To access the Manager GUI from your remote desktop browser, comment out the RemoteAddrValve constraint in /opt/tomcat/webapps/manager/META-INF/context.xml:
Restart Tomcat to apply user and valve changes:
# Comment out the IP Valve restriction in manager context.xml:
sudo sed -i '/Valve className="org.apache.catalina.valves.RemoteAddrValve"/ s/^/<!--/' /opt/tomcat/webapps/manager/META-INF/context.xml
sudo sed -i '/allow="127/ s/$/-->/' /opt/tomcat/webapps/manager/META-INF/context.xml
# Restart Tomcat to apply changes:
sudo systemctl restart tomcat
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
403 Access Denied when opening http://server_ip:8080/manager/html
Cause: The RemoteAddrValve in webapps/manager/META-INF/context.xml blocks non-localhost IP addresses.
Resolution: Comment out the valve block in context.xml or specify your client public IP address in the allow regex.
sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml && sudo systemctl restart tomcat
Tomcat service fails to start: Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
Cause: The JAVA_HOME path inside /etc/systemd/system/tomcat.service is incorrect or missing.
Resolution: Verify your Java home directory using readlink -f $(which java) and update the service unit file.
readlink -f $(which java)
Port 8080 already in use (bind: Address already in use)
Cause: Another process or a previous unmonitored Tomcat instance is already bound to port 8080.
Resolution: Identify the PID holding port 8080 using sudo ss -tulpn | grep :8080 and stop the conflicting process.
sudo ss -tulpn | grep :8080
Security Best Practices and Hardening
Always set a complex, unique password for the admin manager user in tomcat-users.xml to prevent unauthorized WAR deployments.
Never run Tomcat as the root user; the dedicated unprivileged tomcat system user isolates Java processes from the host OS.
In production, place Tomcat behind an Nginx or Apache reverse proxy with Let's Encrypt SSL encryption on port 443.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
- How to Install Java on Ubuntu 24.04 — Comprehensive guide to OpenJDK 17 and OpenJDK 21 installations.
- How to Install Nginx on Ubuntu 24.04 — Set up Nginx as an SSL-terminating reverse proxy in front of Tomcat.
- Initial Server Setup on Ubuntu 24.04 LTS — Configure system security baselines, firewalls, and users.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
javax.* namespace to the modern Jakarta EE jakarta.* namespace. Applications built for Java EE 8/Tomcat 9 must be updated or converted using the Tomcat Migration Tool to run on Tomcat 10..war file directly into /opt/tomcat/webapps/ (Tomcat unpacks and deploys it automatically), or upload it through the web-based Manager App at http://your_ip:8080/manager/html./opt/tomcat/logs/catalina.out and standard HTTP access logs to /opt/tomcat/logs/localhost_access_log.[date].txt./opt/tomcat/conf/server.xml, locate <Connector port="8080" protocol="HTTP/1.1" ...>, change 8080 to 80, and restart Tomcat (or preferably use Nginx on port 80 proxying to 8080).Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides
Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!