Apache Tomcat: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 10: | Line 10: | ||
groupadd tomcat | groupadd tomcat | ||
useradd -r -g tomcat -d /opt/tomcat -s /sbin/nologin tomcat | useradd -r -g tomcat -d /opt/tomcat -s /sbin/nologin tomcat | ||
chown -R tomcat: /opt/tomcat | chown -R tomcat: /opt/tomcat | ||
chmod o+x /opt/tomcat/bin | chmod o+x /opt/tomcat/bin | ||
# chmod -R g+r /opt/tomcat/conf | |||
# chmod g+x /opt/tomcat/conf | |||
</source> | </source> | ||
Revision as of 09:28, 27 February 2021
apt update; apt list --upgradable
mkdir /opt/tomcat; cd /opt/tomcat/
wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.63/bin/apache-tomcat-8.5.63.tar.gz
tar -xzvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
Permission
groupadd tomcat
useradd -r -g tomcat -d /opt/tomcat -s /sbin/nologin tomcat
chown -R tomcat: /opt/tomcat
chmod o+x /opt/tomcat/bin
# chmod -R g+r /opt/tomcat/conf
# chmod g+x /opt/tomcat/conf
Service
update-java-alternatives -l
nano /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-armhf/jre
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
systemctl daemon-reload
systemctl enable tomcat
systemctl start tomcat
systemctl status tomcat
tail -f /opt/tomcat/logs/catalina.out
ssh [email protected] -L 8080:localhost:8080 http://localhost:8080/