Server Guru

Just another Tech Blog

LinuxTomcatUbuntu

How to Install Tomcat 8 and 9 on Ubuntu 17.04 17.10 18.04

If this solution helped you then please click on any of the ads on this page to support us.

Installation of Tomcat is pretty easy on Linux servers.

Step 1 : Download the Tomcat Binary from its official site using the following command.

 

wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz

 

Step 2 : Extract the files .

tar -xzvf apache-tomcat-8.5.24.tar.gz

 

Step 3 : Create a folder for tomcat under “/opt/tomcat” and move the files from the extracted folder to new location

 

root@server:~/new# mkdir /opt/tomcat
root@server:~/new# mv apache-tomcat-8.5.24 /opt/tomcat/
root@server:~/new# ls /opt/tomcat/
apache-tomcat-8.5.24
root@server:~/new#

 

Step 4 : If Java is not installed already then please install the latest version using the following command.

 

apt-get install openjdk-8jdk

 

root@server:~/new# java -version
openjdk version “1.8.0_151”
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
root@server:~/new#

 

Step 6 : Export the variables JAVA_HOME and CATALINA_HOME to system.

 

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.24

 

Step 7  : Start Tomcat using the startup script.

 

 

root@server:~/new# sh /opt/tomcat/apache-tomcat-8.5.24/bin/startup.sh
Using CATALINA_BASE: /opt/tomcat/apache-tomcat-8.5.24
Using CATALINA_HOME: /opt/tomcat/apache-tomcat-8.5.24
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.5.24/temp
Using JRE_HOME: /usr/lib/jvm/java-8-openjdk-amd64
Using CLASSPATH: /opt/tomcat/apache-tomcat-8.5.24/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.5.24/bin/tomcat-juli.jar
Tomcat started.
root@server:~/new#

 

Step 8 : Now you can access tomcat using the IP address “http://127.0.0.1:8080”

 

Additional Points :

To stop tomcat  :

root@server:~/new# sh /opt/tomcat/apache-tomcat-8.5.24/bin/shutdown.sh
Using CATALINA_BASE: /opt/tomcat/apache-tomcat-8.5.24
Using CATALINA_HOME: /opt/tomcat/apache-tomcat-8.5.24
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.5.24/temp
Using JRE_HOME: /usr/lib/jvm/java-8-openjdk-amd64
Using CLASSPATH: /opt/tomcat/apache-tomcat-8.5.24/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.5.24/bin/tomcat-juli.jar
root@server:~/new#

 

If this solution helped you then please click on any of the ads on this page to support us.

5 thoughts on “How to Install Tomcat 8 and 9 on Ubuntu 17.04 17.10 18.04

Leave a Reply to krishna Cancel reply