How to Install Tomcat 10 on Ubuntu 20.04
Apache Tomcat is an open-source web server with a servlet container for publishing Java-based web applications. Tomcat is developed and maintained by an open community of developers under the auspi...
Key Architecture Takeaways
- ›Point 1: Production blueprint for How to Install Tomcat 10 on Ubuntu 20.04 on Linux infrastructure.
- ›Point 2: Covers root privilege management, daemon supervision via systemd, and secure file operations.
- ›Point 3: Applies to LTS releases (Ubuntu 24.04/22.04 LTS, Debian 12 Bookworm).
Enterprise Compatibility Update (2026 / LTS)
While these fundamentals apply directly to existing deployments, modern installations on Ubuntu 22.04 and 24.04 LTS use systemd-resolved, nftables for packet filtering, and modern OpenSSH 9+ with Ed25519 cryptography.
Apache Tomcat is an open-source web server with a servlet container for publishing Java-based web applications. Tomcat is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. To know more about the Apache Tomcat visit the apache official site http://tomcat.apache.org/.
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.
Step 1 - Install Java
You must have JRE (Java runtime environment) installed on your system. Tomcat 10 required to have JRE 8 or higher version installed on your system. Use the following command to install OpenJDK to fulfill the requirements.
sudo apt update
sudo apt install default-jdkCheck the current active Java version:
java -versionStep 2 - Create Tomcat User
We recommended to run 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:
sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcatThe 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 to check to download the latest Tomcat version from the official download server. Use the below command to download Tomcat 10.
wget https://mirrors.estointernet.in/apache/tomcat/tomcat-10/v10.0.5/bin/apache-tomcat-10.0.5.tar.gzOnce the download completed, extract the downloaded archive and copy all content to the tomcat home directory.
sudo tar xzvf apache-tomcat-10.0.5.tar.gz -C /opt/tomcat --strip-components=1Next, set the proper file permissions.
sudo chown -R tomcat:tomcat /opt/tomcat/
sudo chmod -R u+x /opt/tomcat/binYou have now the latest Tomcat application on your system.
Step 4 - Create Tomcat User
Now, configure your tomcat with user accounts to secure access to admin/manager pages. To do this, edit conf/tomcat-users.xml file in your editor and paste the following code inside <tomcat-users> </tomcat-users> tags. We recommend changing the password in the below configuration with high secured password.
sudo nano /opt/tomcat/conf/tomcat-users.xmlAdd the following values. Make sure to change the password for admin and manager access.
<!-- user manager can access only manager section -->
<role rolename="manager-gui" />
<user username="manager" password="Your_Password" roles="manager-gui" />
<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="Your_Password" roles="manager-gui,admin-gui" />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 these pages from the remote system, you need to modify the following configuration files.
You can either allow specific remote system or allow all. Edit the context.xml file for the manager and host manager application:
sudo nano /opt/tomcat/webapps/manager/META-INF/context.xmlComment out the section added for IP address restriction to allow connections from anywhere.
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
`<!--` <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> `-->` ... </Context>Similarly edit context.xml for host-manager application in the text editor:
sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xmlComment out the same section to allow connections from anywhere.
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<!--<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
...
</Context>Save all files and close them.
Step 6 - Create a Tomcat Systemd Unit File
Tomcat provides bash scripts to start, stop service. But, to make it simpler, create a startup script to manage Tomcat as systemd service. Let's create a tomcat.service file with the following content:
sudo nano /etc/systemd/system/tomcat.servicebash [Unit] Description=Tomcat After=network.target
[Service] Type=forking
User=tomcat Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64" Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom" Environment="CATALINA_BASE=/opt/tomcat" Environment="CATALINA_HOME=/opt/tomcat" Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid" Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh
[Install] WantedBy=multi-user.target
Reload the systemd daemon service to load newly create files.bash sudo systemctl daemon-reload
Now, start the Tomcat application for the first time.bash sudo systemctl start tomcat.service
Next, enable the tomcat service to auto start for subsequent system boots. This is more important for the production deployments.bash sudo systemctl enable tomcat.service
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)`".bash sudo systemctl status tomcat.service
[](https://www.technhit.in/wp-content/uploads/2021/05/screen2.png)
## 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 the 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:bash http://localhost:8080/ ```
You will see the page like below:
Conclusion
You have a running Tomcat server on the Ubuntu 20.04 system.


