logo

한국어

CentOS7에 aoache-tomcat 8 버전 설치

관리자 2018.08.06 13:09 조회 수 : 16

1. /opt에 apache-tomcat 압축 해제 및 사용자 추가

cd /opt
tar xvzf ~/apache-tomcat-8.5.32.tar.gz
ln -s apache-tomcat-8.5.32 tomcat
useradd -d /opt/tomcat -c "Apache-Tomcat" -s /bin/false tomcat
chown -R tomcat:tomcat /opt/tomcat /opt/apache-tomcat-8.5.32

 

2. systemd 설정파일 작성

vi /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/java-8-oracle/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms3072M -Xmx2048M -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

 

3. systemd 활성화
systemctl daemon-reload

 

4. apache-tomcat 실행
systemctl restart tomcat