[CentOS] tomcat 설치

1. tomcat download

# curl -O <<tomcat download 주소>>


https://tomcat.apache.org/download-90.cgi



2. tomcat 압축해제 후 /opt 폴더로 이동

# tar xvzpf apache-tomcat-9.0.13.tar.gz

# mv apache-tomcat-9.0.13 /opt

# cd /opt; mv apache-tomcat-9.0.13 tomcat


3. tomcat 유저/group 생성 및 소유권 변경

# useradd tomcat

# groupadd tomcat

# cd /opt

# chown -R tomcat:tomcat tomcat


4. systemd 등록

>> vi /etc/systemd/system/tomcat.service

# cat /etc/systemd/system/tomcat.service

# 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


5. 데몬재시작 및 tomcat 실행

# systemctl daemon-reload

# systemctl start tomcat


'Programming > CentOS' 카테고리의 다른 글

SSH Key CentOS 비밀번호 없이 로그인  (0) 2019.06.28
[centos7] node 최신버전 설치..  (0) 2019.04.21
[CentOs] nginx 설치하기  (0) 2019.03.08
[CentOS] java 설치  (0) 2018.02.18