OS/Linux

Ubuntu 20.04 : Tomcat 8.5.85 설치

파란크리스마스 2023. 2. 10. 23:48
728x90

출처

jdk 설치

root@bluexmas:~# apt install openjdk-11-jdk-headless

tomcat 설치

root@bluexmas:~# cd /opt
root@bluexmas:/opt# wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.85/bin/apache-tomcat-8.5.85.tar.gz
root@bluexmas:/opt# tar xvfz apache-tomcat-8.5.85.tar.gz
root@bluexmas:/opt# mv apache-tomcat-8.5.85 tomcat

서비스 등록 파일 tomcat.service 생성

root@bluexmas:/opt# vi /etc/systemd/system/tomcat.service

tomcat.service 내용

[Unit]
Description=tomcat 8
After=network.target syslog.target

[Service]
Type=forking
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
User=root
Group=root
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

tomcat 서비스 등록

root@bluexmas:/opt# systemctl enable tomcat.service
Created symlink /etc/systemd/system/multi-user.target.wants/tomcat.service → /etc/systemd/system/tomcat.service.

tomcat 서비스 실행

root@bluexmas:/opt# systemctl start tomcat.service

tomcat 서비스 상태 확인

root@hyukkwonweb:/opt# systemctl status tomcat.service
● tomcat.service - tomcat 8
     Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-02-11 00:01:48 KST; 23s ago
    Process: 31828 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS)
   Main PID: 31847 (java)
      Tasks: 33 (limit: 3509)
     Memory: 97.1M
     CGroup: /system.slice/tomcat.service
             └─31847 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/loggin>
 
Feb 11 00:01:48 hyukkwonweb.cafe24.com systemd[1]: Starting tomcat 8...
Feb 11 00:01:48 hyukkwonweb.cafe24.com startup.sh[31828]: Tomcat started.
Feb 11 00:01:48 hyukkwonweb.cafe24.com systemd[1]: Started tomcat 8.
lines 1-13/13 (END)