Decorative image for blog on installing Tomcat
October 20, 2022

How to Install Apache Tomcat

Tomcat
Java

If you have decided to install Apache Tomcat, you’re in good company — according to the 2022 Java Developer Productivity Report produced by JRebel, 48% of developers use Tomcat as the web server for their main application.

In this blog, learn methods and best practices for optimal Tomcat installation so you can get off on the right foot with Tomcat.

Back to top

Getting Started With Apache Tomcat

Installing Apache Tomcat right the first time can mean lower costs and fewer headaches down the road. 

What Is Apache Tomcat?

Apache Tomcat is a lightweight open source Java web server and Java Servlet container that was initially released in 1998.

Tomcat has been a top-level Apache project since 2005, and the last major release was Tomcat 10, which came out in 2020.

Tomcat Installation Requirements

Tomcat installation is relatively straightforward, but will vary depending on what operating system you have. Before installing Tomcat, you’ll need to install Java if you have not already done so. You can determine which version of Java to use by referring to this handy chart on the Tomcat website. Once you have Java installed, set your JAVA_HOME variable.

Back to top

How to Install Apache Tomcat on Windows

First, you’ll want to acquire either the Windows Tomcat binary from the official Tomcat website or the Windows service installer. Using the service installer takes you through a guided install like a typical Windows program. Using the binary allows you the portability of running out of the directory and then simply deleting the directory when you are finished with Tomcat.

With the binary download, after downloading and extracting, you’ll want to place the Tomcat parent directory in the desired location. Inside of the parent directory of Tomcat, you’ll find a similar layout to the Linux binary. Inside of that folder there is a directory called bin, and inside there is the executable file for Tomcat. Once Tomcat is up and running, use a browser to navigate to the IP address on port 8080 to see if the splash page is up.

Back to top

How to Install Apache Tomcat on macOS and Linux

For Apple’s macOS, you’ll have two options available to you. You can download the binary from Tomcat’s official site, or if you have the Homebrew package manager installed, you can execute the command “brew install tomcat” and the binary will be installed like yum or apt-get on Linux.

If you use the binary, once extracted, place the directory where you’d like Tomcat to live; however, you can just leave it in the home directory and run it from there if you wish. Once extracted, navigate to the bin directory where you’ll find two shell scripts: startup.sh and shutdown.sh. By running startup.sh and navigating to a web browser, you can then input the IP address of your Tomcat server followed by the port number of 8080. You should see the Tomcat splash page letting you know your server is up and running.

The process for Linux is the same as macOS since macOS is a POSIX type system. The same tar.gz or .zip files will work, and just like Homebrew, Tomcat can be installed via package managers as well, which is an easier experience for some.

Get Tomcat Tips From Our Experts

Choosing Tomcat is easy, but finding long-term success can be tricky. Our free Enterprise Guide to Apache Tomcat includes best practices for performance, security, resilience, and more.

Enterprise Guide to Apache Tomcat


Download Guide

Back to top

How to Install Apache Tomcat With Source Code

This option is best for those who wish to compile the source code themselves. One advantage of doing this is that you can compile Tomcat with additional modules and features not found in the default installation, giving you a more powerful and robust version of Tomcat.

You will need additional software that requires some knowhow to use in order to build the code from scratch, whether it’s Linux or Windows. Included in the source materials is a text document labeled BUILDING.txt that contains all the instructions for building Tomcat from source. You’ll use Apache Ant to do the code construction and you must manually create a build.properties file in order to give Tomcat instructions. Inside the build.properties file you’ll specify a base.path for dependencies, which will look something like:

# ----- Default Base Path for Dependent Packages -----
# Replace this path with the directory path where
# dependencies binaries should be downloaded.
base.path=/home/me/some-place-to-download-to

After you’ve completed your configuration in build.properties, simply run the ant command to build and compile the code. You will find your completed software in ${tomcat.source}/output/build

An IDE tool like Eclipse or IntelliJ Idea can be helpful with building the source code as well. Further guidance on how to do that can be found in the official project documentation

Back to top

Next Steps After Tomcat Installation

Out-of-the-box Tomcat can be “functional” but it’s far from completely set up. Tomcat configuration and tuning are essential steps to getting the most out of your instance. Setting time outs, disk usage, security (encryptions and certificates), and the amount of active connections will improve your Tomcat performance and allow you to utilize more features than what is just standard. This part of Tomcat installation will require the greatest amount of time and testing but it is necessary if you want to ensure optimal performance. 

Back to top

Final Thoughts

Hopefully after reading this blog, you have a solid grasp on how to install Apache Tomcat. Correct Tomcat installation is the first step toward a successful deployment. But it is truly just the first step, and taking advantage of all that Tomcat can do requires configuring settings appropriate for your use case, putting the right security features in place, and upgrading Tomcat when new versions become available.

Support For Your Tomcat Deployments

OpenLogic offers 24/7/365 Tomcat support that’s backed by SLAs and delivered directly by enterprise architects with 15+ years of experience. Talk to a Tomcat expert today to see how OpenLogic can help configure, maintain, and improve your Tomcat deployments. 

Talk to a Tomcat Expert

Additional Resources

Back to top