Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 18, 2021 08:21 pm GMT

How to install Apache Tomcat 9 on Ubuntu 20.04 LTS

About This Article

This article is about how to install Apache Tomcat 9 using 'tar.gz' on Ubuntu 20.04 LTS. Hope you will learn something. Cheers!

Prerequisite

You need to have Java 8 installed on your machine.
Tomcat 9 works on only Java 8. More Information.

You can confirm the java version with the following command.

java -version

Let's install Apache Tomcat 9

  1. Visit Apache Tomcat Site.
  2. Download Apache Tomcat 9.

    • Download tar.gz (pgp, sha512) the Core Binary Distributions of the Apache Tomcat.
  3. Open up your terminal and cd into the directory where you have downloaded the Apache Tomcat tar.gz file.

Tip: You can open up the terminal by pressing Ctrl + Alt + T on your keyboard.

cd /home/<type-username-here>/Downloads
  1. Extract the tar.gz file to /opt directory with the following command.
sudo tar -xf apache-tomcat-9.0.55.tar.gz -C /opt

Setting up the Catalina environment variable.

  1. Let's cd into the Tomcat directory.
cd /opt/apache-tomcat-9.0.55/
  1. You can see the current directory by running the following command. Copy the path of the current directory. This is the path of the tomcat 9.
pwd
  1. Now open up the terminal and type the following command to get the root access. You will need to provide the password if needed.
sudo su
  1. Open up the ~/.bashrc file using gedit and the Catalina environment variable.
gedit ~/.bashrc
  1. Scroll down to the end of the document and set the Catalina environment variable. /opt/apache-tomcat-9.0.55 is the path of the tomcat which you copied earlier.
export CATALINA_HOME=/opt/apache-tomcat-9.0.55
  1. Save the ~/.bashrc file and close gedit window.

Run Tomcat 9

  1. You can run Tomcat 9 by running the following command.
sh startup.sh
  1. Now you can open up a web browser and navigate to the tomcat URL. If you can see the Tomcat initial page. Then you have successfully installed and the tomcat 9 server is up and running.
http://localhost:8080/
  1. If you want to shut down the Tomcat server, you can do so by running the following command.
sh shutdown.sh


Below you can find a screenshot of my terminal.

Screenshot of the terminal


Original Link: https://dev.to/dhanushaperera07/how-to-install-apache-tomcat-9-on-ubuntu-2004-lts-b5m

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To