-
Notifications
You must be signed in to change notification settings - Fork 45
/
Tomcat
61 lines (43 loc) · 2.14 KB
/
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
52
53
54
55
56
57
58
59
60
61
sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcat
wget http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.tar.gz -P /tmp
sudo tar xf /tmp/apache-tomcat-9*.tar.gz -C /opt/tomcat
ln -s /opt/tomcat/apache-tomcat-9.0.14 /opt/tomcat/latest
sudo chown -RH tomcat: /opt/tomcat/apache-tomcat-9.0.24/
sudo sh -c 'chmod +x /opt/tomcat/apache-tomcat-9.0.24/bin/*.sh'
### Java Path -> /usr/lib/jvm/java-8-openjdk-amd64
sudo vi /etc/systemd/system/tomcat.service
#################################################################### Add the entry in tomcat.service ##########################
[Unit]
Description=Tomcat 9 servlet container
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
Environment="CATALINA_BASE=/opt/tomcat/apache-tomcat-9.0.24"
Environment="CATALINA_HOME=/opt/tomcat/apache-tomcat-9.0.24"
Environment="CATALINA_PID=/opt/tomcat/apache-tomcat-9.0.24/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/opt/tomcat/apache-tomcat-9.0.24/bin/startup.sh
ExecStop=/opt/tomcat/apache-tomcat-9.0.24/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
#################################################################### End the entry in tomcat.service ##########################
sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl status tomcat
sudo vi /opt/tomcat/apache-tomcat-9.0.24/conf/tomcat-users.xml
########################################## Added file ############################################################################
<tomcat-users>
<!--
Comments
-->
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin_password" roles="admin-gui,manager-gui"/>
</tomcat-users>
###################################################################################################################################
sudo systemctl restart tomcat
http://<your_domain_or_IP_address>:8080