tomcat

windows下Tomcat详细安装配置教程

How to Install Java on Windows

How to install Tomcat on CentOS 7

CentOS下安装Tomcat环境

如何在 Ubuntu 20.04 上安装 Tomcat 9

Install tomcat on Ubuntu

#设置tomcat组和用户
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat 
sudo chgrp -R tomcat /opt/tomcat
sudo chmod -R g+r conf
sudo chmod g+x conf

cd /opt/tomcat
sudo chown -R tomcat webapps/ work/ temp/ logs/

#配置启动service
#sudo nano /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64/
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.awt.headless=true -Djava.security.egd=file:/dev/v/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

#启动service
sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl enable tomcat