How to install Apache Tomcat on Ubuntu or Debian

Last updated on July 31, 2020 by Dan Nanni

Question: I need to run a Java web application, and for that I'm trying to use Apache Tomcat. How can I install Apache Tomcat on Debian or Ubuntu Linux?

Apache Tomcat is an open-source implementation of Java servlet engine and a J2EE container. It is one of the most popular applications in today's enterprise data centers, and there are many enterprise web applications powered by Apache Tomcat.

To install Apache Tomcat on Ubuntu or Debian, follow the steps here.

Apache Tomcat requires Java Development Kit (JDK). Thus, first install JDK on your Linux system.

Next, download Apache Tomcat (apache-tomcat-<version>.tar.gz) from its official website.

After downloading Tomcat, extract it in the /opt destination folder as follows.

$ sudo tar xvzf apache-tomcat-<version>.tar.gz -C /opt

Change the Tomcat conf files world-readable.

$ sudo chmod +r /opt/apache-tomcat-<version>/conf/*

Define CATALINA_HOME environment variable in your .bashrc file.

$ vi ~/.bashrc
CATALINA_HOME=/opt/apache-tomcat-7.0.35

Reload .bashrc file as follows.

$ source ~/.bashrc

Now enable Tomcat by running the following startup script.

$ sudo $CATALINA_HOME/bin/startup.sh

At this point, you should be able to access Tomcat by going to http://<ip-address-of-linux>:8080 on your web browser. If everything is okay, you should see the following web page.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean