First download apache tomcat


Decompress the downloaded apache tomcat:

tar zxvf apache-tomcat-7.0.76.tar.gz

Now move the decompressed file in the following location:

mv apache-tomcat-7.0.76 /opt/tomcat

Install java

apt-get install default-jdk

Set the environment variables in .bashrc:

nano ~/.bashrc

Add the following lines to the end of the file:

export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=/opt/tomcat

Simply save and exit .bashrc, then make the changes effective by running the following command:

. ~/.bashrc

To start Tomcat, run the following script:


You should get a result similar to:

Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/default-java
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

Test through web browser by the address: