How to Install Apache Tomcat on Debian 11 | Holhol24


Apache Tomcat (in the past referred to as Apache Jakarta Tomcat) is an open-source implementation of the Java Servlet and JavaServer Pages applied sciences.

Here, we can see how you can set up Apache Tomcat on Debian 11.

Install Java

Tomcat calls for Java JRE at the gadget. You can both set up Oracle JDK or OpenJDK.

For this demo, we can cross with OpenJDK.

sudo apt set up -y openjdk-11-jdk-jre

Once Java is put in, you’ll be able to check the Java edition through the usage of the next command.

java -version


openjdk edition "11.0.7" 2020-04-14
OpenJDK Runtime Environment (construct 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (construct 11.0.7+10-post-Ubuntu-3ubuntu1, combined mode)

Create Tomcat Service Account

For best possible observe, Tomcat will have to by no means be run as a privileged consumer (root). So, create a standard consumer for operating the Tomcat carrier.

sudo groupadd tomcat

sudo mkdir /decide/tomcat

sudo useradd -g tomcat -d /decide/tomcat -s /usr/sbin/nologin tomcat

Download Apache Tomcat

You can obtain the Apache Tomcat package deal from the reputable site.

Download Apache Tomcat 10

Download Apache Tomcat 9.0

Download Apache Tomcat 8.5.70


In the terminal, use the wget command to obtain the Apache Tomcat.

### Apache Tomcat 10.x


### Apache Tomcat 9.x


### Apache Tomcat 8.5.x


Extract the tomcat onto your required (/decide/tomcat) listing.

sudo tar -zxvf apache-tomcat-*.tar.gz

sudo mv apache-tomcat-*/* /decide/tomcat/

Change the possession of the listing to permit the tomcat consumer to write down recordsdata to it.

sudo chown -R tomcat:tomcat /decide/tomcat/

Setup Apache Tomcat

Here, we use the systemd to start out the Tomcat carrier. Tomcat’s systemd carrier report calls for java location. So, run the under command to listing the java variations to be had for your gadget.

sudo update-java-alternatives -l


java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64

At this time, I’ve Java 11 on my gadget.

Create a tomcat systemd carrier report. Green ones rely at the setting, so trade them accordingly.

sudo nano /and many others/systemd/gadget/tomcat.carrier

Add the under knowledge to the Tomcat systemd carrier report.

Description=Apache Tomcat 9.x Web Application Container




Environment='CATALINA_OPTS=-Xms512M -Xmx1G -Djava.web.preferIPv4Stack=true'


Restart=at all times

Sought afterBy=multi-user.goal

Reload systemd daemon.

sudo systemctl daemon-reload

Manage Apache Tomcat Service

To get started the Tomcat carrier; run:

sudo systemctl get started tomcat

Check the standing of Tomcat, run:

sudo systemctl standing tomcat

Enable the car get started of Tomcat carrier on gadget boot:

sudo systemctl allow tomcat

By default, Apache Tomcat runs on port 8080. Use the netstat command to test the Tomcat carrier listening standing.

sudo netstat -antup | grep 8080


tcp        0      0  *               LISTEN      1611/java

READ: netstat command now not discovered on Ubuntu – Quick Fix

Configure Apache Tomcat Web UI

Tomcat comes with the internet supervisor and Host Manager for managing Tomcat. Both the Host Manager and Web Manager are password-protected.

To get right of entry to the internet software supervisor and host-manager,  we can create a consumer with the manager-gui and admin-gui roles.

Edit tomcat-users.xml report so as to add the jobs.

sudo nano /decide/tomcat/conf/tomcat-users.xml

Add the under traces (position and consumer definition) simply sooner than the ultimate line.

admin" password="password" roles="manager-gui,admin-gui"/>

For safety causes, Web Manager and Host Manager are available simplest from the localhost, i.e., from the server itself.

To get right of entry to internet and host managers from exterior techniques, you should upload the supply community to the permit listing.

To do this, edit the under two recordsdata.

sudo nano /decide/tomcat/webapps/supervisor/META-INF/context.xml

sudo nano /decide/tomcat/webapps/host-manager/META-INF/context.xml

Update the under line on each the recordsdata with the supply IP / community from which you get right of entry to the internet and host Manager.

permit="127.d+.d+.d+|::1|0:0:0:0:0:0:0:1|.*" />

.* will permit all networks to have get right of entry to to each managers.


permit="127.d+.d+.d+|::1|0:0:0:0:0:0:0:1|192.168.0.*" />

You too can permit a part of your community simplest. For instance: To permit the community simplest, you’ll be able to use the above one.

Restart the Tomcat carrier.

sudo systemctl restart tomcat

Access Apache Tomcat

Open a browser and cross to the under URL.

You would get Apache Tomcat’s default web page, and this confirms that Apache Tomcat is effectively put in.

Apache Tomcat Default Page

Web Application Manager

Click at the Manager App to get right of entry to Web Manager (Login Required): Username: admin, Password: password.

Using internet supervisor, you’ll be able to deploy a brand new software, deploy an software in a specified context, get started, prevent, reload, and un-deploy an software.

Tomcat Web Application Manager
Tomcat Web Application Manager

Server Status

Also, you’ll be able to take a look at the Tomcat server standing.

Tomcat Server Status
Tomcat Server Status

Virtual Host Manager

Click on Host Manager to get right of entry to Tomcat host supervisor (Login Required): Username: admin, Password: password.

Here, you’ll be able to set up digital hosts.

Tomcat Virtual Host Manager
Tomcat Virtual Host Manager


That’s All. I am hoping you might have discovered how you can set up Apache Tomcat on Debian 11. The gadget is now in a position for the deployment of your first internet software. As a safety advice, imagine imposing SSL/TLS for Tomcat

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More