Thursday, April 4, 2013

Installing tomcat7 on CentOS 6.3


Java should be installed before installing tomcat, please read my previous blog to install java
Download apache tomcat from here
#wget http://apache.techartifact.com/mirror/tomcat/tomcat-7/v7.0.39/bin/apache-tomcat-#7.0.39.tar.gz
#tar -xvf apache-tomcat-7.0.39.tar.gz
#mv apache-tomcat-7.0.39 tomcat-7.0.39
#mv tomcat-7.0.39/ /usr/share/
cd /usr/share/tomcat-7.0.39/
Now create tomcat service and set it to start on boot
#vim /etc/init.d/tomcat and paste the below on to that
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/tomcat7
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0 
#chkconfig --add tomcat
#chkconfig --level 234 tomcat on
#chkconfig --list tomcat
Now you can start stop tomcat by executing the below command
#service tomcat stop
#service tomcat start
This should work fine now.

No comments:

Post a Comment