linux centos7 tomcat8 配置成服务启动

1. tomact 解压到/usr/local/tomcat下

2.vim /usr/local/tomcat/bin/catalina.sh

  在OS specific support.前加上 (注意java 安装目录)

  JAVA_HOME=/usr/java/jdk1.8.0_161
  JRE_HOME=$JAVA_HOME/jre

 

3.配置tomcat service 文件

  vi /usr/lib/systemd/system/tomcat.service

  输入:  

[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=oneshot
ExecStart=/usr/local/tomcat/bin/startup.sh
ExecStop=/usr/local/tomcat/bin/shutdown.sh
ExecReload=/bin/kill -s HUP $MAINPID
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

4.允许开机启动

  systemctl enable tomcat

5.启动,查看状态,重启,关闭 tomcat

  systemctl start tomcat.service

  systemctl status tomcat.service

  systemctl restart tomcat.service

  systemctl stop tomcat.service

 

posted @ 2018-09-05 23:30  M_Y_522  阅读(3679)  评论(0编辑  收藏  举报