linux之centos7安装tomcat并配置成服务运行
1、官网下载安装包,放到指定的目录下,解压(不需要环境变量)2、新建tomcat服务文件/lib/systemd/system/tomcat.service,内容如下[Unit]Description=TomcatAfter=syslog.target[Service]Type=forkingExecStart=/data/test/tomcat/apache-tomcat-9.0.20/bin/
·
1、官网下载安装包,放到指定的目录下,解压(不需要环境变量)
2、新建tomcat服务文件/lib/systemd/system/tomcat.service,内容如下
[Unit]
Description=Tomcat
After=syslog.target
[Service]
Type=forking
ExecStart=/data/test/tomcat/apache-tomcat-9.0.20/bin/catalina.sh start
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
User=root
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
3、
执行systemctl daemon-reload来重载服务
//查看service状态: systemctl status tomcat
//配置开机启动: systemctl enable tomcat
//启动tomcat: systemctl start tomcat
//停止tomcat: systemctl stop tomcat
//重启tomcat: systemctl restart tomcat
更多推荐
所有评论(0)