An Interest In:
Web News this Week
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
November 18, 2021 08:21 pm GMT
Original Link: https://dev.to/dhanushaperera07/how-to-install-apache-tomcat-9-on-ubuntu-2004-lts-b5m
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
- Visit Apache Tomcat Site.
Download Apache Tomcat 9.
- Download
tar.gz (pgp, sha512)
the Core Binary Distributions of the Apache Tomcat.
- Download
Open up your terminal and
cd
into the directory where you have downloaded the Apache Tomcattar.gz
file.
Tip: You can open up the terminal by pressing Ctrl + Alt + T on your keyboard.
cd /home/<type-username-here>/Downloads
- 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.
- Let's cd into the Tomcat directory.
cd /opt/apache-tomcat-9.0.55/
- 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
- 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
- Open up the ~/.bashrc file using gedit and the Catalina environment variable.
gedit ~/.bashrc
- 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
- Save the
~/.bashrc
file and close gedit window.
Run Tomcat 9
- You can run Tomcat 9 by running the following command.
sh startup.sh
- 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/
- 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.
Original Link: https://dev.to/dhanushaperera07/how-to-install-apache-tomcat-9-on-ubuntu-2004-lts-b5m
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To