This article is about how to install Apache Tomcat 9 using 'tar.gz' on Ubuntu 20.04 LTS. Hope you will learn something. Cheers!
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.
- Visit Apache Tomcat Site.
Download Apache Tomcat 9.
tar.gz (pgp, sha512)the Core Binary Distributions of the Apache Tomcat.
Open up your terminal and
cdinto the directory where you have downloaded the Apache Tomcat
Tip: You can open up the terminal by pressing Ctrl + Alt + T on your keyboard.
- Extract the
/optdirectory with the following command.
sudo tar -xf apache-tomcat-9.0.55.tar.gz -C /opt
- Let's cd into the Tomcat directory.
- 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.
- Now open up the terminal and type the following command to get the root access. You will need to provide the password if needed.
- Open up the ~/.bashrc file using gedit and the Catalina environment variable.
- Scroll down to the end of the document and set the Catalina environment variable.
/opt/apache-tomcat-9.0.55is the path of the tomcat which you copied earlier.
- Save the
~/.bashrcfile and close gedit window.
- You can run Tomcat 9 by running the following command.
- 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.
- If you want to shut down the Tomcat server, you can do so by running the following command.
Below you can find a screenshot of my terminal.