http://tomcat.apache.org/download-80.cgi 下载tomcat core .tar.gz
在 /usr/local/ 下 tar -zxvf apache-tomcat-8.0.35.tar.gz 解压
mv apache-tomcat-8.0.35/ tomcat/
vi tomcat/bin/setclasspath.sh 设置
JAVA_HOME=/usr/java/jdk1.8.0_91
JRE_HOME=/usr/java/jdk1.8.0_91/jre
新建 /etc/init.d/tomcat
#!/bin/bash
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat by ton
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description: Start up the Tomcat servlet engine.
set -m
CATALINA_HOME="/usr/local/tomcat"
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "/atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi
# running tomcat services
RETVAL=$?
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
restart)
if [ -f $CATALINA_HOME/bin/startup.sh ];then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
sleep 5
if [ -f $CATALINA_HOME/bin/shutdown.sh ];then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
修改权限 chmod +x tomcat