-
用 root 用户直接启动没有问题
/opt/tomcat/bin/startup.sh
-
创建 tomcat 用户
useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat cd /opt/tomcat sudo chgrp -R tomcat /opt/tomcat sudo chmod -R g+r conf sudo chmod g+x conf chown -R tomcat webapps/ work/ temp/ logs/
/etc/systemd/system/tomcat.service
[Unit] Description=Apache Tomcat Web Application Container After=network.target [Service] Type=forking Environment=JRE_HOME=/usr/local/jre Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target
-
正常启动
-
无法访问