How to Install Apache Tomcat on Ubuntu

$ sudo apt-get install openjdk-8-jdk 

Downoad apache tomcat 8 from website https://tomcat.apache.org/download-80.cgi , this can be downloaded as below,

$ wget -c https://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gz 
$ tar xvf apache-tomcat-8.5.53.tar.gz
$ mv apache-tomcat-8.5.53 tomcat

Now, we need to export the following parameters, for this we can create the script as,

$ vim setenv.sh 
#!/bin/bash
TOMCAT_DIR=$PWD/tomcat

export CATALINA_BASE=$TOMCAT_DIR
export CATALINA_HOME=$TOMCAT_DIR
export CATALINA_TMPDIR=$TOMCAT_DIR/temp/

we need to source the paramaters as,

$ source setenv.sh 

Now, we can start the tomcat server as,

$ bash $PWD/tomcat/bin/startup.sh 

Now the server is up and running at http://localhost:8080/

This server can be stopped as,

$ bash $PWD/tomcat/bin/shutdown.sh 
Follow Lynxbee

Leave a Reply / Ask Question