Saturday, April 18, 2015

Ubuntu 14.04 - Install Apache Tomcate – Set CATALINA_HOME


How to Install Apache Tomcat on Ubuntu System and set CATALINA_HOME environment variable.


Note: Verify you have jdk already installed or not ? if NOT then follow This tutorial.

There are two way to install tomcat
  1. Using apt-get
  2. Manually

Method 1 : Install Apache Tomcat with apt-get using below command

$ apt-get install tomcat7

above command will install the latest one available, for me it is apache-tomcat-7.0.59


Method 2 : Install Apache Tomcate Manually
  • First download the required version Binary Distributions/ ZIP file from apache.  
  •  
  • Once done with the download extract the file to /opt/, move to opt folder and execute below commands
     
  • 
    $ cd /opt
    
    $ sudo tar -xvzf ~/Downloads/apache-tomcat-*.tar.gz
    
    
     
  • Once extract done, you will see the apache-tomcat folder under /opt folder.

Configure CATALINA_HOME


It is always helpful to set environment variable CATALINA_HOME for tomcate, I personally recommend to set it in .bashrc.

  • open bashrc using below command.
  •  
    
    $ sudo gedit ~/.bashrc
    
    
  • add below lines at the end of the bashrc file. DONE : Save and close the file. 
  •  
    
    # environment variable for tomcate 
    export CATALINA_HOME=/opt/apache-tomcat-7.0.59
    
    # environment variable for JAVA
    export JAVA_HOME=/usr/lib/jvm/java-7-oracle
    
    
     
  • make sure you have set the environment variable properly. 
  • 
    $ $CATALINA_HOME/bin/startup.sh
    
    
    Tomcat should be started.  
    
    $ $CATALINA_HOME/bin/shutdown.sh
    
    
    Tomcat should be shutdown.



19 comments:

  1. To Remove Tomcat for First method ....

    sudo apt-get remove tomcat7

    ReplyDelete