Bootstrap FreeKB - Tomcat - Install Tomcat on Linux
Tomcat - Install Tomcat on Linux

Updated:   |  Tomcat articles

Download Tomcat from If you are using a text-only version of Linux, use wget to download the gzip compressed tar archive.

cd /tmp


Extract the gzip compressed tar archive. In this example, it is extracted to the /opt directory.

tar -zxvpf apache-tomcat-<version>.tar.gz --directory /opt


By default, Tomcat will listen on the following ports:

  • Port 8005 for SHUTDOWN connections
  • Port 8080 for HTTP connections
  • Port 8443 for HTTPS connections

Use the netstat command to determine if any other services are using ports 8005, 8080 and 8443.

netstat -ano | grep 8005
netstat -ano | grep 8080
netstat -ano | grep 8443


If there is a service using port 8005, 8080 or 8443, update Tomcat to use some other unused port.

Optionally, rename the extracted directory from "apache-tomcat-<version>" to "tomcat".

mv /opt/apache-tomcat-<version> /opt/tomcat


If Java Runtime Environment (JRE) is not installed, use apt-get or yum to install JRE.

yum install jre


If you have a firewall, such as iptable or firewalld (Linux), open ports 8080 and 8443.

You can now start Tomcat. The ps command can be used to verify that Tomcat is running. If the ps command returns something like this, Tomcat is running.

ps -ef | grep -i tomcat<version> | grep -v grep

root  86359      1  2 08:48 pts/0    00:00:02 /usr/bin/java -Djava.util.logging.config.file=/opt/Apache/Tomcat9.0.37/conf/ -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dignore.endorsed.dirs= -classpath /opt/Apache/Tomcat9.0.37/bin/bootstrap.jar:/opt/Apache/Tomcat9.0.37/bin/tomcat-juli.jar -Dcatalina.base=/opt/Apache/Tomcat9.0.37 -Dcatalina.home=/opt/Apache/Tomcat9.0.37 org.apache.catalina.startup.Bootstrap start


On a PC in the same subnet as the web server, navigate to http://localhost:8080. The default page should be displayed.


The /opt/tomcat/conf/web.xml file will contain the default documents. In this example, the default documents are index.html, index.htm, and index.jsp. By default, only the index.jsp file will be installed, at /opt/tomcat/webapps/ROOT/index.jsp.



Directories can be added to the /opt/tomcat/webapps directory, and then files can be added to the new directory. For example, a directory named testing can be created.

~]# mkdir /opt/tomcat/webapps/testing


Files can then be added to the /opt/tomcat/webapps/testing directory. For example, adding example.jsp with the text Hello there will allow you to navigate to http://localhost:8080/testing/example.jsp and display the Hello there page.



If some problem occurs, check the /opt/tomcat/logs/catalina.out file.

Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


Add a Comment

Please enter bb73b9 in the box below so that we can be sure you are a human.