How to Install Tomcat 9 on Ubuntu 16.04, 18.04 & 19.10 LTS Easy Guide
Install Tomcat 9
Table of Contents
The Java-based web application is hosted by Tomcat, a web server. The Apache Tomcat team has released Tomcat 9. This guide will show you how to install Tomcat 9 on Ubuntu 19.10, 18.04 LTS, and 16.04 LTS.
Step 1: Verify/Install Java
Before you can install Apache Tomcat on a Linux VPS, you must first install Java. To run Tomcat 9, you will need Java 8 or later. You should double-check that the correct version of Java is installed.
java -version java version "11.0.2" 2019-01-15 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
Run the commands below to fulfill requirements if you do not have Java installed or have an older version.
sudo apt-get update sudo apt-get install default-jdk
Step 2: Download and Install Apache Tomcat 9
To get the Tomcat archive, go to the official download page or one of its mirrors. Using the commands below, download and install the Apache Tomcat 9 archive file. You should also go to the official download page to get the latest version.
wget http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.35/bin/apache-tomcat-9.0.35.tar.gz tar xzf apache-tomcat-9.0.35.tar.gz sudo mv apache-tomcat-9.0.35 /usr/local/tomcat9
Step 3: Configure the Required Environment Variables
Configure the Tomcat’s required environment variables now. Set CATALINA HOME to the tomcat directory that was extracted. Set Java environment variables according to the Java version installed on your system.
echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc echo "export JAVA_HOME="/usr/lib/jvm/java-11-oracle"" >> ~/.bashrc echo "export JRE_HOME="/usr/lib/jvm/java-11-oracle"" >> ~/.bashrc source ~/.bashrc
Step 4: Create User Accounts for Tomcat
Finally, in order to secure and access
admin/manager pages, we must create user accounts. Copy the contents of the
conf/tomcat-users.xml file into the and
Step 5: Enable Remote IP Host/Manager
Only localhost is allowed to access the default manager and host-manager web pages. You must enable the IP or IP range in the application-specific context.xml file to access these pages from a remote system.
Manager File: ./webapps/manager/META-INF/context.xml Host Manager File: ./webapps/host-manager/META-INF/context.xml
Edit the above files and replace your IP address like the one seen in the screenshot. Restart Tomcat after you have made the changes.
Step 6: Start Tomcat 9 Service
Tomcat is very simple to use; there is no need to compile its source. Simply unpack the archive and launch the Tomcat server. Tomcat starts on port 8080 by chance, so make sure no other applications are using the same port.
cd /usr/local/apache-tomcat9 chmod +x ./bin/startup.sh ./bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat9 Using CATALINA_HOME: /usr/local/tomcat9 Using CATALINA_TMPDIR: /usr/local/tomcat9/temp Using JRE_HOME: /usr/lib/jvm/java-11-oracle Using CLASSPATH: /usr/local/tomcat9/bin/bootstrap.jar:/usr/local/tomcat9/bin/tomcat-juli.jar Tomcat started.
Step 7: Access Tomcat 9 in Browser
The default port for the Tomcat server is 8080. Connect your server to port 8080 in your web browser to use Tomcat.
Tomcat Home– This is Tomcat 9’s default home page. This page does not need authentication to access.
To access the Manager App, go to the home page and click the Manager App link. This page is open to both administrators and managers.
To access the Host Manager page:- On your Tomcat home page, click the Host Manager link. This page is only accessible to administrators.
How to Spend a Weekend in Los Angeles
Los Angeles has it all: sunshine, beaches, spunky speakeasies, and Hollywood stars! Even if you only have a weekend in…