Install Tomcat 9 in the environment where CentOS-8.1.1911-x86_64 was installed by "minimum installation". JAVA must be installed in advance. Please refer to here for installing JAVA.
useradd -s /sbin/nologin tomcat
curl -O http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/tomcat/tomcat-9/v9.0.34/bin/apache-tomcat-9.0.34.tar.gz
tar xvzf apache-tomcat-9.0.34.tar.gz -C /opt
ln -s /opt/apache-tomcat-9.0.34 /opt/apache-tomcat
chown -R tomcat. /opt/apache-tomcat-9.0.34
echo "export CATALINA_HOME=/opt/apache-tomcat" > /etc/profile.d/tomcat.sh
source /etc/profile
vi /etc/systemd/system/tomcat.service
tomcat.service
[Unit]
Description=Apache Tomcat 9
After=syslog.target network.target
[Service]
User=tomcat
Group=tomcat
Type=oneshot
PIDFile=/opt/apache-tomcat/tomcat.pid
RemainAfterExit=yes
ExecStart=/opt/apache-tomcat/bin/startup.sh
ExecStop=/opt/apache-tomcat/bin/shutdown.sh
ExecReStart=/opt/apache-tomcat/bin/shutdown.sh;/opt/apache-tomcat/bin/startup.sh
[Install]
WantedBy=multi-user.target
chmod 755 /etc/systemd/system/tomcat.service
firewall-cmd --add-port=8080/tcp --zone=public --permanent
systemctl restart firewalld
systemctl start tomcat
systemctl restart tomcat
systemctl stop tomcat
systemctl enable tomcat
/opt/apache-tomcat/bin/version.sh
Using CATALINA_BASE: /opt/apache-tomcat
Using CATALINA_HOME: /opt/apache-tomcat
Using CATALINA_TMPDIR: /opt/apache-tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/apache-tomcat/bin/bootstrap.jar:/opt/apache-tomcat/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Server version: Apache Tomcat/9.0.34
Server built: Apr 3 2020 12:02:52 UTC
Server number: 9.0.34.0
OS Name: Linux
OS Version: 4.18.0-147.8.1.el8_1.x86_64
Architecture: amd64
JVM Version: 11.0.7+10
JVM Vendor: AdoptOpenJDK
http://hostname:8080/docs/ It is OK if you access to and the following page is displayed.
You have successfully installed it.
Recommended Posts