Install Apache Tomcat

Apache Tomcat is one of the Java Server Runtimes that you can use to deploy Java web applications. In this tutorial, I will show you how to install Apache Tomcat!

First, go to the Download page of Apache Tomcat to download its latest version https://tomcat.apache.org/download-10.cgi. Depending on the operating system you are using, please download the installation file of Apache Tomcat accordingly. If it’s Windows, you can download the .zip file, and if it’s macOS or Linux, download the .tar.gz file:

After downloading, please extract this download file:

To start Apache Tomcat, we must first make sure that the JAVA_HOME environment variable points to the Java installation directory. My example is as follows:

Next, if you are using macOS or Linux, you need to make sure that the user you are logged in, is the owner of the tomcat folder:

and the .sh files in the bin directory of Apache Tomcat have permission to execute:

If the files of Apache Tomcat do not meet the above two conditions, you can run the following command to assign the owner to the user you are using for the directory of Apache Tomcat:

and the following command to assign execute permission to the .sh files in the bin directory of Apache Tomcat:

You can run with sudo privileges if necessary!

At this point, you can open Terminal or Console and go to the bin directory of Apache Tomcat, then run the following command to start it up:

On macOS or Linux:

On Window:

Its results are as follows:

Now, go to the address http://localhost:8080/, you will see the following result:

So we have successfully installed Apache Tomcat already!

To stop it, you can run the following command in the bin directory of Apache Tomcat:

On macOS or Linux:

On Windows:

Add Comment