下载
wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.36/bin/apache-tomcat-9.0.36.tar.gz
解压
tar zxf apache-tomcat-9.0.36.tar.gz -C /usr/local/
配置脚本
vim /etc/init.d/tomcat
文件内容如下:
#!/bin/bash # # tomcat startup script for the Tomcat server # # chkconfig: 345 80 20 # description: start the tomcat deamon # # Source function library JAVA_HOME=/opt/java/jdk1.8.0_202 export JAVA_HOME CATALANA_HOME=/usr/local/apache-tomcat-9.0.36 export CATALANA_HOME case "$1" in start) echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; stop) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh ;; restart) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh sleep 2 echo echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; *) echo "Usage: $prog {start|stop|restart}" ;; esac exit 0
配置好server.xml和context.xml
添加到开机启动
chkconfig --add tomcat chkconfig --list tomcat chkconfig --level 2345 tomcat on
启动
systemctl start tomcat systemctl status tomcat标签:bin,Tomcat,tomcat,部署,CATALANA,echo,centos7,HOME From: https://www.cnblogs.com/A121/p/17806653.html