javascript
Brief description  about Online courses   join in Online courses
OR

How To Install & Configure Tomcat 7 In Linux

SQL  Trainer
SQL Trainer
Working

To Install tomcat 7 first we need to install jdk-7 . So To install java (jdk-7) follow the below steps :

 Step 1: Download the tar file of java according to your architecture using this link

“http://www.oracle.com/technetwork/java/javase/downloads/index.html"

 Step 2:create a directory using below command

# mkdir /usr/java

 Step 3:Now unpack the zip file in /usr/java using tar command

# tar  zxpvf  jdk-7u9-linux-x64.tar.gz  -C  /usr/java/

 This will create the directory /usr/java/jdk1.7.0_09 . This will be our JAVA_HOME

 Step 4:Now we set the Java Home and will put Java into the path of our users using below command

 # JAVA_HOME=/usr/java/jdk1.7.0_09/

# export  JAVA_HOME

# PATH=$JAVA_HOME/bin:$PATH

# export PATH

 To set the JAVA_HOME permanently, we need to add above commands  to the ~/.bash_profile of the user (in this case, root) or we can add it /etc/profile and then source it to give to all users.

Now Install Tomcat 7

 Step 1:First download the zipped file using the the below url

“http://tomcat.apache.org/download-70.cgi”

 Step 2:We will install tomcat under “/usr/share” directory , Now unzip the tomcat file using below command:

# tar zxpvf   /root/apache-tomcat-7.0.32.tar.gz -C /usr/share

This will create a directory  “/usr/share/apache-tomcat-7.0.32”

 Step 3:Now we will create a script called “tomcat” under /etc/init.d directory . 

# vi tomcat

 #!/bin/bash

# description: Tomcat Start Stop Restart

# processname: tomcat

#  chkconfig: 234 20 80

JAVA_HOME=/usr/java/jdk1.7.0_09

export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH

export PATH

CATALINA_HOME=/usr/share/apache-tomcat-7.0.32

 case $1 in

start)

sh $CATALINA_HOME/bin/startup.sh

;;

sh $CATALINA_HOME/bin/shutdown.sh

;;

restart)

sh $CATALINA_HOME/bin/shutdown.sh

sh $CATALINA_HOME/bin/startup.sh

;;

esac

exit 0

 

Save and exit the file

Step 4:Assign the right permissions to tomcat script and add to chckconfig utility using below commands

 # cd  /etc/init.d

#  chmod 755 tomcat

# chkconfig --add  tomcat

# chkconfig  --level 35  tomcat on

 Step 5:Now start the tomcat service

# /etc/init.d/tomcat start

similarly we stop and restart the tomcat service.

Step 6:We can now access the Tomcat Manager page at:

http://yourdomain.com:8080


Write your comment now
 
Reader's comments(10)
1: great
Posted by:NILESH - 08 Dec, 2017
2: s
Posted by:s - 28 Sep, 2015
3: chkconfig is out of date. It is unavailable
Is there any other alternative ?

Thanks,
Sandilya
Posted by:sandilya - 11 Mar, 2015
4: Hi..

Can anyone please tell me why
sh $CATALINA_HOME/bin/shutdown.sh is used in start) case.

As per my understanding here we only want to start tomcat so why we are calling shutdown.sh

Please help to understand.

Thanks,
Vinayak

;;
Posted by:Vinayak - 16 Dec, 2014
5: great article.....thanks....

worked for me.
Posted by:prem - 03 Dec, 2014
6: Hi Ganesh
what is CATALINA_HOME=/usr/share/apache-tomcat-7.0.32.
why should we add this parameter.
Posted by:raj - 11 Nov, 2014
7: Hi,
I read this article, this is very useful & simple configuration procedure.Thanks
Posted by:ganesh - 20 Nov, 2013
8: continue...
stop)
Posted by:md rfai - 26 Jun, 2013
9: hi.,

i am new to this linux and i have read this article.
this is useful to me.
but i think you have missed one line at tomcat file in init.d.
say.,
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
Posted by:md rafi - 26 Jun, 2013
10:
yes.. It works if you put stop)
Dinesh Replied to: md - 26 Mar, 2015