Open In App

How to Install Apache Tomcat 8 on Linux?

Apache Tomcat (short for “Tomcat”) is a free and open-source Java Servlet, JavaServer Pages, Java Expression Language, and WebSocket implementation. [two] Tomcat is an HTTP web server that runs Java code in a “pure Java” environment.

Tomcat is developed and maintained by a free group of developers under the Apache Software Foundation’s auspices and is licensed under the Apache License 2.0. In this article, we are going to see how to install Apache Tomcat 8 on Linux systems.



Installing Apache Tomcat 8:

Create a directory named tomcat in the /opt folder:

$ mkdir /opt/tomcat

Create a directory

Change directory to tomcat:



$ cd /opt/tomcat

Change directory to tomcat

Go to the Apache Tomcat 8 Download page by clicking this link. Place your cursor under 8.5.65 Binary Distributions, right-click on the tar file and select the copy link address from the menu that appears (as shown in the picture below). At the time of writing, Tomcat 8 is the most recent edition, but you are free to use whatever version is most current.

Next, use the wget command to download the tar from the URL you copied in the previous stage to the tomcat folder on your server:

$ sudo wget https://apachemirror.wuchna.com/tomcat/tomcat-8/v8.5.65/bin/apache-tomcat-8.5.65.tar.gz

Decompress the file in your tomcat folder after it has finished downloading:

$ tar xvzf apache-tomcat-8.5.65.tar.gz

Decompress the file

Installing Java:

You must first install the Java Development Kit before you can use Tomcat (JDK). Check to see if Java is installed first:

$ apt-get install default-jdk

Installing the Java Development Kit

Now verify java installed properly:

$ java -version

Verify java installed properly

Configure .bashrc File:

Use the following command to set the environment variables in .bashrc: 

$ nano ~/.bashrc

Add the following lines to the file’s end:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.65

After you’ve saved your changes and exited the .bashrc file, run the following command to make the changes take effect:

$ . ~/.bashrc

Your server should now have Tomcat and Java enabled and configured. Run the following script to start Tomcat:

$ $CATALINA_HOME/bin/startup.sh

In a web browser, go to YourIPAddress:8080 to see if Tomcat is up and running. http://127.0.0.1:8080, for example.

Article Tags :