Tomcat安装部署

一、解压tomcat 至/usr/local

二、在/usr/lib/systemd/system/目录下新建文件tomcat8.service,内容如下:

#!/bin/bash
[Unit] 
Description=Tomcat8
After=syslog.target network.target remote-fs.target nss-lookup.target 
   
[Service] 
Type=forking
Environment='JAVA_HOME=/opt/jdk1.8.0_66'
Environment='CATALINA_PID=/opt/apache-tomcat-8.5.29/bin/tomcat.pid'
Environment='CATALINA_HOME=/opt/apache-tomcat-8.5.29/'
Environment='CATALINA_BASE=/opt/apache-tomcat-8.5.29/'

WorkingDirectory=/opt/apache-tomcat-8.5.29/ 
  
ExecStart=/opt/apache-tomcat-8.5.29/bin/startup.sh 
ExecReload=/bin/kill -s HUP $MAINPID 
ExecStop=/bin/kill -s QUIT $MAINPID 
PrivateTmp=true
   
[Install] 
WantedBy=multi-user.target

三、systemctl daemon-reload

四、设置为开启机启动:systemctl enable tomcat7

 

posted @ 2020-08-02 23:40  小小仓鼠  阅读(169)  评论(0编辑  收藏  举报