在liunx开发环境下,Tomcat部署配置为系统服务

创建用户,安装tomcat


#添加tomcat用户

useradd tomcat
passwd tomcat

(apachet0mcat)

#创建存放tomcat应用的目录,并授权给tomcat用户

sudo mkdir /gsww/tomcat
sudo chown tomcat /gsww/tomcat

cd /gsww/tomcat

#下载并部署tocmat

wget http://apache.mirror.globo.tech/tomcat/tomcat-9/v9.0.0.M26/bin/apache-tomcat-9.0.0.M26.tar.gz

tar xvfz apache-tomcat-9.0.0.M26.tar.gz

tomcat做成linux服务

sudo vi /etc/systemd/system/tomcat9.service

填入以下内容

[unit]

Description=Apache Tomcat Web Application Container

After=syslog.target network.target

[Service]

Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre

Environment=CATALINA_PID=/gsww/tomcat/apache-tomcat-9.0.0.M26/temp/tomcat.pid

Environment=CATALINA_HOME=/gsww/tomcat/apache-tomcat-9.0.0.M26

Environment=CATALINA_BASE

你可能感兴趣的:(Java,tomcat,liunx,在liunx开发环境下,Tomcat部署配置为系统服务)