Apache Tomcat, a widely used Java Servlet container, provides a powerful platform for deploying Java-based web applications. In this tutorial, we’ll walk through the process of installing Tomcat 10 on Ubuntu 22.04, enabling you to set up a robust environment for Java web development.
Step 1: Update Package Index
Before installing Tomcat, it’s essential to ensure that your package index is up to date. Run the following command to update the package index:
$ sudo apt update
Step 2: Install Java Development Kit (JDK)
Tomcat requires Java to run. Install the default JDK package using the following command:
$ sudo apt install default-jdk
Step 3: Download Apache Tomcat
Navigate to the official Apache Tomcat website and download the latest version of Tomcat 10. Alternatively, you can use wget
to download the Tomcat archive directly from the command line:
$ wget https://downloads.apache.org/tomcat/tomcat-10/v10.x.x/bin/apache-tomcat-10.x.x.tar.gz
Replace v10.x.x
with the latest version number.
Step 4: Extract Tomcat Archive
Once the download is complete, extract the Tomcat archive using the following command:
$ sudo tar -xf apache-tomcat-10.x.x.tar.gz -C /opt
Step 5: Set Environment Variables
Set the CATALINA_HOME
environment variable to point to the Tomcat installation directory:
$ echo 'export CATALINA_HOME="/opt/apache-tomcat-10.x.x"' | sudo tee -a ~/.bashrc
$ source ~/.bashrc
Step 6: Start Tomcat Service
Navigate to the Tomcat bin
directory and start the Tomcat service:
$ cd $CATALINA_HOME/bin
$ ./startup.sh
Step 7: Access Tomcat Web Interface
Open your web browser and navigate to http://localhost:8080
to access the Tomcat web interface. You should see the Tomcat welcome page, indicating that Tomcat has been successfully installed and is running.
Conclusion
Congratulations! You’ve successfully installed Apache Tomcat 10 on Ubuntu 22.04. With Tomcat up and running, you can now deploy and manage Java web applications with ease. Explore the features and capabilities of Tomcat to build powerful and scalable web solutions.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.