How to install Apache Tomcat on Ubuntu or Debian

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

Reload .bashrc file as follows.

$ source ~/.bashrc

Now enable Tomcat by running the following startup script.

$ sudo $CATALINA_HOME/bin/

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.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *