> ## Content Index
> Fetch the complete content index at: https://blog.alphavps.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Install Apache Tomcat on an Ubuntu 24.04 VPS
- URL: https://blog.alphavps.com/how-to-install-apache-tomcat-on-an-ubuntu-24-04-vps/
- Published: 2025-12-16T11:09:09.000Z
- Updated: 2026-09-08T15:18:12.000Z
- Author: Karim Buzdar
- Tags: Tutorials, Ubuntu, Web Servers

Apache Tomcat is the most widely used open-source Java application server developed by the Apache Software Foundation and built for deploying Java Servlets and JSPs. Tomcat is now a lightweight but highly extensible and detailed server for developing into a cross-cutting set of development applications, making it probably the best known and most used free or open source servlet container. Setting up Apache Tomcat on a VPS You can host your web application that is capable of serving dynamic web pages using Tomcat.

In this tutorial, we will show you how to install Apache Tomcat 8 on an Ubuntu 24.04 VPS and have it run under the default Tomcat user account, making your installation more secure from potential attacks.

If you’re deploying Java apps that benefit from strong CPU and fast NVMe, our **High-Performance VPS** line is a great match: balanced compute, fast storage, and full root access for Java/Tomcat stacks.  
👉 [https://alphavps.com/high-performance-vps.html](https://alphavps.com/high-performance-vps.html?ref=blog.alphavps.com)

If you’re just testing Tomcat or running small dev demos, start lean with our **Cheap VPS** and scale later:  
👉 [https://alphavps.com/cheap-vps.html](https://alphavps.com/cheap-vps.html?ref=blog.alphavps.com)

I’ll walk through each step with commands **and** explanations.

## **How to Install Apache Tomcat on an Ubuntu 24.04 VPS**

For developers and system administrators who need a reliable, scalable Java application server built using the professional-quality open source package from the Apache Software Foundation, Tomcat will be a backbone for anyone navigating their Ubuntu 24.04 VPS looking for performance, stability, and dependability.

## **Step 1: Update packages & install Java** 

Tomcat runs on Java. Install an up-to-date OpenJDK (Tomcat 10.1 is built with OpenJDK 18) x needs Java 11+). Check on their site for what Java version your version of Tomcat needs.

```bash
sudo apt update
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-9d5a9bf5-b06f-4da1-a493-c26e477946e6.png)

Install OpenJDK 17 (safe and modern default). If you prefer, you can also use openjdk-11-jdk. Tomcat is a Java servlet container; it needs JRE/JDK.

```bash
sudo apt install -y openjdk-17-jdk
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-e458115d-d96d-4fda-8ef6-b0c9bbd8cbf8.png)

Verify Java:

From the above command, Java is installed. First, the readlink | sed command prints the JAVA\_HOME path (to then be able to populate correctly with Help in editing here) systemd file.

```bash
java -version
# and determine JAVA_HOME
readlink -f "$(which java)" | sed 's:bin/java::'
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-2376ed2c-eb5f-4817-99a7-c365a9af9ff5.png)

## **Step 2: Create a dedicated Tomcat user**

Running Tomcat as a stand-alone user lowers the attack vector: if an attacker compromises Tomcat, there is only limited access to the system. Use a non-privileged user to start Tomcat for security.

```bash
sudo groupadd --system tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat --system tomcat
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-65306cc7-0be5-4f66-8d5d-8a65f609c739.png)

## **Step 3: Download Tomcat** 

Choose the latest stable Tomcat release (below is an example with 10.1.47 – go to the Tomcat download page and mirrors for the current). Always choose the Official Releases download and check their checksums/signatures.

```bash
cd /tmp
wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.0.8/bin/apache-tomcat-10.0.8.tar.gz
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-63ede8ad-3652-4991-bfb9-de88ee4fa4fa.png)

Extract to /opt/tomcat:

```bash
# create install dir and extract (strip top component into /opt/tomcat)
sudo mkdir -p /opt/tomcat
sudo tar xzf apache-tomcat-10.0.8.tar.gz
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-724ed1d8-9adb-44d2-9fe5-8333461ca5de.png)

/opt is the usual place for optional or third-party software. When you go this route, your Tomcat will be kept separately from system-wide packages, and upgrades will be simpler in the future.

```bash
sudo mv apache-tomcat-10.0.8/* /opt/tomcat
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-9b7e9fb6-2c71-4fff-b04a-252497335d96.png)

Note - check your downloads: Tomcat new SHA512 checksums and OpenPGP signatures; it is recommended to check before posting the production. It is suggested by the Tomcat download page.

## **Step 4: Set ownership and adjust permissions**

Tomcat needs to read its conf files, write logs/work/temp, and execute scripts. Assigning ownership to a loyal end-user also makes the system secure and predictable.

Enter the user and group that should own the installation, tomcat in this example.

```bash
sudo chown -R www-data:www-data /opt/tomcat/
sudo chmod -R 755 /opt/tomcat/
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-14569216-f7b8-441d-b7aa-1997ce446608.png)

## **Step 5: Create a systemd unit**

Then create a systemd service to control Tomcat just like any other service.

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

```ini
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
# Point JAVA_HOME to your JDK path; adjust if different
Environment=JAVA_HOME=/usr/lib/jvm/java-17-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:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
```

## **Step 6: Manage systemd services**

systemd takes care of the process lifecycle, resets it when it crashes, and will autostart Tomcat on boot.

Then enable and start:

```bash
sudo systemctl daemon-reload
sudo systemctl enable --now tomcat
sudo systemctl start tomcat
sudo systemctl status tomcat --no-pager
```

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-69cad4fb-ee16-4113-bd61-8bb9919e0c49.png)

## **Step 7: Test that Tomcat is running**

It will be great to check the status of the process and HTTP response to see if Tomcat is up, listening to the port, or not. Now go to http://YOUR\_SERVER\_IP:8080/ from your desktop — you should see the Tomcat welcome page:

![](https://blog.alphavps.com/content/images/2025/10/data-src-image-b432400b-c5eb-4a1a-917a-4109a5a22515.png)

That is all from the guide.

## Conclusion

Few additions are as important and simple on a Ubuntu 24.04 VPS as installing Apache Tomcat. By completing the steps to install Java, creating a new Tomcat user, downloading and configuring your server for Tomcat, and then configuring a systemd service file, you are securing your system to ensure that it runs not only efficiently but securely. 

If you’re looking for a [**High-Performance VPS**](https://alphavps.com/high-performance-vps.html?ref=blog.alphavps.com), get in touch with us — we’ll help you find the perfect solution for your business needs.