-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystemctl-tomcat
51 lines (39 loc) · 1.47 KB
/
systemctl-tomcat
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
- Install java
- sudo groupadd tomcat
- sudo useradd -M -s /sbin/nologin -g tomcat -d /opt/tomcat tomcat
- sudo mkdir /opt/tomcat
- sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat
- cd /opt/tomcat
- Change permissions:
sudo chgrp -R tomcat conf
sudo chmod g+rwx conf
sudo chmod g+r conf/*
sudo chown -R tomcat webapps/ work/ temp/ logs/
sudo chown -R tomcat webapps/ work/ temp/ logs/
- Install Systemd Unit File
sudo 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/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
[Install]
WantedBy=multi-user.target
##########################################################################################################
- sudo systemctl daemon-reload
- sudo systemctl start tomcat
- udo systemctl enable tomcat
- Check
systemctl list-units | grep tomcat