How to install Apache Tomcat on Ubuntu

How to install Apache Tomcat on Ubuntu

Purpose – To Build and Install Tomcat 8.0.0-RC5 on Ubuntu 12.04

Pre-requisites –

OS – Ubuntu
sudhir@Ubuntu1:~$ cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION=”Ubuntu 12.04.3 LTS”

Task – In this blog we will be trying to build the Tomcat 8.0.0-RC5 source from scratch and get it up and running
Required softwares – 
JDK version 7 – Download the latest JDK software from Oracle site (i.e jdk-7u45-linux-x64.tar.gz)
– ANT v1.8 or later – Download the latest ANT software from Apache ant project (i.e apache-ant-1.9.2-bin.tar.gz)
– Tomcat 8.0.0-RC5 – Download the Tomcat 8.0 distribution from Apache Tomcat project (i.e apache-tomcat-8.0.0-RC5-src.tar.gz)
Procedure
Step1: Install JDK version 7
                        – Download and copy the JDK package to any location on the machine as shown below and unzip the package
       
Step2: Untar the unzipped package using the below command



Note – By default, the Root account password is locked in Ubuntu. This means that you cannot login as Root directly or use the su command to become the Root user. Use the above command to login as root to bash shell.
Step3: After untar operation below JDK home location would be created under /home/sudhir/java/
          







Step4: Set the above JDK as the default using the below commands




Step5: Install ANT software

                     – Download and copy the ANT package to any location on the machine as shown below
and unzip the package

        – Untar the unzipped package using the below command

       



– After untar operation below ANT home location would be created under /home/sudhir/ant/
         











Step6: Set the JAVA_HOME, ANT_HOME and PATH Variable as shown below in ~/.bashrc file
          – Verify the set vairables using the below commands

       






Step7: Extracting Tomcat package

         – Download and copy the Tomcat package to any location on the machine as shown below and unzip the package
         – Untar the unzipped package using the below command
         


After untar operation below Tomcat home location would be created under /home/sudhir/
         












Step8: Build the apache tomcat using the below commands

       




Step9: Verify the build successful status as shown below

          







Step10: Run the Tomcat using the below command and verify using ps command that a java process was created

         







Step11: Browse the below URL to verify that default page of Tomcat

            URL – http://localhost:8080/

Hope you enjoyed reading this article. Thank you.