Install Java
1 2 3 |
# sudo yum install java-1.8.0-openjdk-devel |
1 2 3 4 5 6 7 8 9 10 11 12 |
# which javac /usr/bin/javac 실경로 # readlink -f /usr/bin/javac /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-0.el7_9.x86_64/bin/javac vi /etc/profile export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-0.el7_9.x86_64 |
Install Tomcat
http://archive.apache.org/dist/tomcat/
1 2 3 4 |
# cd /tmp # wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.39/bin/apache-tomcat-8.5.39.tar.gz |
1 2 3 4 |
sudo mkdir /opt/tomcat sudo tar xvf apache-tomcat-8.5.39.tar.gz -C /opt/tomcat --strip-components=1 |
http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.39/bin/apache-tomcat-8.5.39.tar.gz
Update Permissions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
sudo groupadd tomcat cd /opt/tomcat sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat sudo chgrp -R tomcat /opt/tomcat sudo chmod -R g+r conf sudo chmod g+x conf sudo chown -R tomcat webapps/ work/ temp/ logs/ |
Install Systemd Unit File
1 2 3 |
sudo vi /etc/systemd/system/tomcat.service |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# Systemd unit file for tomcat [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=/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=/bin/kill -15 $MAINPID User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target |
reload Systemd to load the Tomcat
1 2 3 4 5 6 7 8 9 |
sudo systemctl daemon-reload sudo systemctl start tomcat sudo systemctl status tomcat sudo systemctl enable tomcat |
http://server_IP_address:8080