OS/Linux
[Ubuntu 16.04] Tomcat 8.5.x 설치
파란크리스마스
2017. 11. 7. 11:30
728x90
출처 : How To Install Apache Tomcat 8 on Ubuntu 16.04 | DigitalOcean
tomcat 그룹, tomcat 사용자 생성
$ sudo groupadd tomcat $ sudo useradd -g tomcat -s /bin/bash -m tomcat
Tomcat 8.5 다운로드 및 압축해제
$ cd /usr/local $ sudo wget http://mirror.apache-kr.org/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz $ sudo tar xvf apache-tomcat-8.5.23.tar.gz
Tomcat 설치된 경우 tomcat 사용자로 소유자 변경
$ sudo chown -R tomcat:tomcat /usr/local/apache-tomcat-8.5.23
jdk 설치 확인
$ sudo update-java-alternatives -l java-8-oracle 1081 /usr/lib/jvm/java-8-oracle
서비스 파일 작성
$ sudo vi /etc/systemd/system/tomcat.service
[Unit] Description=Apache Tomcat Web Application Container After=network.target [Service] Type=forking Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle Environment=CATALINA_PID=/usr/local/apache-tomcat-8.5.23/temp/tomcat.pid Environment=CATALINA_HOME=/usr/local/apache-tomcat-8.5.23 Environment=CATALINA_BASE=/usr/local/apache-tomcat-8.5.23 Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/usr/local/apache-tomcat-8.5.23/bin/startup.sh ExecStop=/usr/local/apache-tomcat-8.5.23/bin/shutdown.sh User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target
Tomcat 8.5 서비스 등록
$ sudo systemctl daemon-reload $ sudo systemctl enable tomcat (재부팅시 자동실행) Created symlink from /etc/systemd/system/multi-user.target.wants/tomcat.service to /etc/systemd/system/tomcat.service.
Tomcat 8.5 서비스 실행
$ sudo systemctl start tomcat
Tomcat 8.5 서비스 실행 정보 확인
$ systemctl status tomcat.service ● tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; disabled; vendor preset: enabled) Active: active (running) since 화 2017-11-07 14:08:26 KST; 13s ago Process: 32519 ExecStart=/usr/local/apache-tomcat-8.5.23/bin/startup.sh (code=exited, status=0/SUCCESS) Main PID: 32526 (java) CGroup: /system.slice/tomcat.service └─32526 /usr/lib/jvm/java-8-oracle/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-8.5.23/conf/l 11월 07 14:08:26 bluesanta-ubuntu systemd[1]: Starting Apache Tomcat Web Application Container... 11월 07 14:08:26 bluesanta-ubuntu startup.sh[32519]: Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.23 11월 07 14:08:26 bluesanta-ubuntu startup.sh[32519]: Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.23 11월 07 14:08:26 bluesanta-ubuntu startup.sh[32519]: Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.23/temp 11월 07 14:08:26 bluesanta-ubuntu startup.sh[32519]: Using JRE_HOME: /usr/lib/jvm/java-8-oracle 11월 07 14:08:26 bluesanta-ubuntu systemd[1]: Started Apache Tomcat Web Application Container.
Tomcat 8.5 서비스 종료
$ sudo systemctl stop tomcat