Tomcat 7 Version

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Download tomcat 7 version:

curl http://apache.mirrors.tds.net/tomcat/tomcat-7/v7.0.42/bin/apachetomcat-7.0.42.tar.gz | tar xvz

move to share directory


mv apache-tomcat-7.0.42 /usr/share/

create script for tomcat


vi /etc/init.d/tomcat

and add the follow lines...


#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/jdk1.7.0_25
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-7.0.42
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
where JAVA_HOME is your path
[root@~]# echo $JAVA_HOME
/usr/java/jdk1.7.0_25

Now, added permissions


[[email protected]]# chmod 755 tomcat
[[email protected]]# chkconfig --add tomcat
[[email protected]]# chkconfig --level 234 tomcat on

check with
[[email protected]]# chkconfig --list tomcat
tomcat
0:off
1:off
2:on

now run/stop/restart service

3:on

4:on

5:off

6:off

[[email protected]]# service tomcat start


[[email protected]]# service tomcat stop
[[email protected]]# service tomcat restart

You might also like