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…


This content originally appeared on DEV Community and was authored by Dhanusha Perera

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


This content originally appeared on DEV Community and was authored by Dhanusha Perera


Print Share Comment Cite Upload Translate Updates
APA

Dhanusha Perera | Sciencx (2021-11-18T20:21:19+00:00) How to install Apache Tomcat 9 on Ubuntu 20.04 LTS. Retrieved from https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/

MLA
" » How to install Apache Tomcat 9 on Ubuntu 20.04 LTS." Dhanusha Perera | Sciencx - Thursday November 18, 2021, https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/
HARVARD
Dhanusha Perera | Sciencx Thursday November 18, 2021 » How to install Apache Tomcat 9 on Ubuntu 20.04 LTS., viewed ,<https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/>
VANCOUVER
Dhanusha Perera | Sciencx - » How to install Apache Tomcat 9 on Ubuntu 20.04 LTS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/
CHICAGO
" » How to install Apache Tomcat 9 on Ubuntu 20.04 LTS." Dhanusha Perera | Sciencx - Accessed . https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/
IEEE
" » How to install Apache Tomcat 9 on Ubuntu 20.04 LTS." Dhanusha Perera | Sciencx [Online]. Available: https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/. [Accessed: ]
rf:citation
» How to install Apache Tomcat 9 on Ubuntu 20.04 LTS | Dhanusha Perera | Sciencx | https://www.scien.cx/2021/11/18/how-to-install-apache-tomcat-9-on-ubuntu-20-04-lts/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.