Centos6.5 apache-tomcat-7.0.47.tar.gz jdk-8u60-linux-x64.tar.gz
vim install_tomcat.sh
#!/bin/bash
#install tomcat
service iptables stop #关闭防火墙
cd /root/
tar -zxvf apache-tomcat-7.0.47.tar.gz #解压
mv apache-tomcat-7.0.47 /opt/tomcat/ #移动
export JAVA_HOME=/usr/local/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.ja
source /etc/profile #使配置文件生效
/opt/tomcat/apache-tomcat-7.0.47/bin/startup.sh #开启服务
i=ps aux | grep java | wc -l
#判断服务启动成功没有
if [ $i -eq 1 ];
then
echo "服务启动失败"
else
echo "服务启动成功"
fi