Tomcat为java开发,需要先部署jdk环境
1、部署jdk
mkdir /application/jdk-1.8.162 -p
cd /application/jdk-1.8.162
下载或上传jdk源码包
tar xf jdk-8u162-linux-x64.tar.gz
cp -a jdk1.8.0_162/* ./
rm -rf jdk1.8.0_162
ln -s jdk-1.8.162/ jdk
echo ‘export JAVA_HOME="/application/jdk"‘ >> /etc/profile
echo ‘export JRE_HOME="/application/jdk/jre"‘ >> /etc/profile
echo ‘export CLASSPATH="${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib"‘ >> /etc/profile
echo ‘export PATH="${JAVA_HOME}/bin:${JRE_HOME}/bin:${PATH}"‘ >> /etc/profile
source /etc/profile
[[email protected] jdk]# java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
JDK安装完成
2、部署tomcat:
mkdir /application/tomcat-8.0
cd /application/tomcat-8.0
下载或上传tomcat源码包
tar xf apache-tomcat-8.0.48.tar.gz
cp -ar apache-tomcat-8.0.48/* ./
ln -s tomcat-8.0/ tomcat
echo ‘ export CATALINA_HOME="/application/tomcat"‘ >> /etc/profile
echo ‘ export CATALINA_BASE="/application/tomcat"‘ >> /etc/profile
echo ‘export PATH="${CATALINA_HOME}/bin:${PATH}"‘ >> /etc/profile
source /etc/profile
下面是tomcat的启停脚本:
cat >> /etc/init.d/tomcat<<end
#!/bin/bash
#description: Tomcat Start Stop Restart
# processname: tomcat8
#chkconfig: 234 30 80
CATALINA_HOME=/application/tomcat
case \$1 in
start)
sh \$CATALINA_HOME/bin/startup.sh
;;
stop)
sh \$CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh \$CATALINA_HOME/bin/shutdown.sh
sleep 2
sh \$CATALINA_HOME/bin/startup.sh
;;
*)
echo ‘please use : tomcat {start | stop | restart}‘
;;
esac
exit 0
end
/etc/init.d/tomcat start
chkconfig --add tomcat
chkconfig --list|grep tomcat
在浏览器中输入IP:8080,如果出现tomcat界面说明安装成功
另外也可使用/application/tomcat/bin目录下的catalina.sh start或start.up 启动tomcat,使用catalina stop或shutdown.sh关闭tomcat服务
注意:catalina.sh脚本的功能很强大,使用--help查看使用帮助
原文地址:https://www.cnblogs.com/liliyang/p/9742284.html