質問編集履歴
5
表示形式を変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -66,12 +66,34 @@
|
|
66
66
|
|
67
67
|
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[1]: tomcat.service failed.
|
68
68
|
|
69
|
+
|
70
|
+
|
69
71
|
---
|
70
72
|
|
71
73
|
|
72
74
|
|
73
75
|
|
74
76
|
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
75
97
|
構築した環境、やったこと、起こったこと
|
76
98
|
|
77
99
|
---
|
4
省略内容を表示させました
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,7 +42,287 @@
|
|
42
42
|
|
43
43
|
|
44
44
|
|
45
|
-
[root@ip-***-**-**-** ~]#
|
45
|
+
[root@ip-***-**-**-** ~]# ● tomcat.service - Apache Tomcat 9
|
46
|
+
|
47
|
+
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
|
48
|
+
|
49
|
+
Active: failed (Result: exit-code) since Tue 2020-06-30 23:44:57 UTC; 1h 29min ago
|
50
|
+
|
51
|
+
Process: 6534 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC)
|
52
|
+
|
53
|
+
Main PID: 6534 (code=exited, status=203/EXEC)
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[1]: Starting Apache Tomcat 9...
|
58
|
+
|
59
|
+
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[6534]: Failed at step EXEC spawning /opt/tomcat/bin/startup.sh: No such file or directory
|
60
|
+
|
61
|
+
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[1]: tomcat.service: main process exited, code=exited, status=203/EXEC
|
62
|
+
|
63
|
+
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[1]: Failed to start Apache Tomcat 9.
|
64
|
+
|
65
|
+
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[1]: Unit tomcat.service entered failed state.
|
66
|
+
|
67
|
+
Jun 30 23:44:57 ip-172-31-21-33.ap-northeast-1.compute.internal systemd[1]: tomcat.service failed.
|
68
|
+
|
69
|
+
---
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
構築した環境、やったこと、起こったこと
|
76
|
+
|
77
|
+
---
|
78
|
+
|
79
|
+
・EC2インスタンスの作成
|
80
|
+
|
81
|
+
amazon Linux 2 AMIを選択
|
82
|
+
|
83
|
+
インスタンスタイプ:t2microを選択
|
84
|
+
|
85
|
+
インスタンスの詳細設定:ネットワーク(vpcデフォルト)、サブネット(アベイラビリティゾーンのデフォルト)、自動割り当てパブリック(サブネット設定を使用)
|
86
|
+
|
87
|
+
ストレージの追加:ボリュームタイプ(ルート)、デバイス(/dev/xvda)、サイズ(8GB)、ボリュームタイプ(汎用SSD(qp2))
|
88
|
+
|
89
|
+
セキュリティグループの設定
|
90
|
+
|
91
|
+
HTTP TCP 80 0.0.0.0/0 -
|
92
|
+
|
93
|
+
HTTP TCP 80 ::/0 -
|
94
|
+
|
95
|
+
カスタム TCP TCP 8080 0.0.0.0/0 -
|
96
|
+
|
97
|
+
SSH TCP 22 0.0.0.0/0 -
|
98
|
+
|
99
|
+
MYSQL/Aurora TCP 3306 0.0.0.0/0 -
|
100
|
+
|
101
|
+
MYSQL/Aurora TCP 3306 ::/0 -
|
102
|
+
|
103
|
+
HTTPS TCP 443 0.0.0.0/0 -
|
104
|
+
|
105
|
+
HTTPS TCP 443 ::/0
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
・TeraTermをインストール
|
112
|
+
|
113
|
+
・EC2に接続
|
114
|
+
|
115
|
+
・mysqlをインストール
|
116
|
+
|
117
|
+
・EC2をRDSに接続
|
118
|
+
|
119
|
+
・Apacheをインストール
|
120
|
+
|
121
|
+
・JDKインストール(java-1.8.0-openjdk java-1.8.0-openjdk-devel )
|
122
|
+
|
123
|
+
・tomcatユーザー作成
|
124
|
+
|
125
|
+
・tomcatのダウンロード(http://ftp.riken.jp/net/apache/tomcat/tomcat-9/v9.0.36/bin/apache-tomcat-9.0.36.tar.gz)
|
126
|
+
|
127
|
+
・tomcatを展開
|
128
|
+
|
129
|
+
・tomcatのシンボリックリンク作成
|
130
|
+
|
131
|
+
ln -s /opt/apache-tomcat-9.0.36 /opt/tomcat
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
・tomcatのログシンボリックリンク作成
|
136
|
+
|
137
|
+
ln -s /opt/apache-tomcat/logs /var/log/tomcat
|
138
|
+
|
139
|
+
chown -h tomcat:tomcat /var/log/tomcat
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
・firewall設定
|
148
|
+
|
149
|
+
firewall-cmd --list-services --zone=public --permanent
|
150
|
+
|
151
|
+
ssh dhcpv6-client
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
vi /etc/firewalld/services/tomcat.xml
|
156
|
+
|
157
|
+
以下のコードを追加
|
158
|
+
|
159
|
+
<?xml version="1.0" encoding="utf-8"?>
|
160
|
+
|
161
|
+
<service>
|
162
|
+
|
163
|
+
<short>Apache Tomcat 9</short>
|
164
|
+
|
165
|
+
<description>Apache Tomcat 9</description>
|
166
|
+
|
167
|
+
<port protocol="tcp" port="8080"/>
|
168
|
+
|
169
|
+
</service>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
・設定を反映
|
174
|
+
|
175
|
+
firewall-cmd --add-service=tomcat --zone=public --permanent
|
176
|
+
|
177
|
+
firewall-cmd --reload
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
・SELinux無効化
|
182
|
+
|
183
|
+
vi /etc/selinux/config
|
184
|
+
|
185
|
+
This file controls the state of SELinux on the system.
|
186
|
+
|
187
|
+
SELINUX= can take one of these three values:
|
188
|
+
|
189
|
+
enforcing - SELinux security policy is enforced.
|
190
|
+
|
191
|
+
permissive - SELinux prints warnings instead of enforcing.
|
192
|
+
|
193
|
+
disabled - No SELinux policy is loaded.
|
194
|
+
|
195
|
+
SELINUX=disabled
|
196
|
+
|
197
|
+
SELINUXTYPE= can take one of three two values:
|
198
|
+
|
199
|
+
targeted - Targeted processes are protected,
|
200
|
+
|
201
|
+
minimum - Modification of targeted policy. Only selected processes are protected.
|
202
|
+
|
203
|
+
mls - Multi Level Security protection.
|
204
|
+
|
205
|
+
SELINUXTYPE=targeted
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
・再起動
|
210
|
+
|
211
|
+
reboot
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
・TomcatとApacheを起動
|
216
|
+
|
217
|
+
systemctl start httpd.service
|
218
|
+
|
219
|
+
systemctl start tomcat.service
|
220
|
+
|
221
|
+
起動確認
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
webアプリケーションマネージャーの設定
|
226
|
+
|
227
|
+
vi /opt/tomcat/conf/tomcat-users.xml
|
228
|
+
|
229
|
+
以下のコードを記述
|
230
|
+
|
231
|
+
<role rolename="manager-gui"/>
|
232
|
+
|
233
|
+
<user username="XXXX" password="XXXX" roles="manager-gui"/>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
vi /opt/tomcat/webapps/manager/META-INF/context.xml
|
238
|
+
|
239
|
+
以下のコードを記述
|
240
|
+
|
241
|
+
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
|
242
|
+
|
243
|
+
allow="\d+.\d+.\d+.\d+|::1|0:0:0:0:0:0:0:1" />
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
再起動し設定反映
|
248
|
+
|
249
|
+
systemctl restart tomcat
|
250
|
+
|
251
|
+
しかし、webアプリケーションマネージャーを開けない
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
・tomcat自動起動設定
|
258
|
+
|
259
|
+
新規ファイルでtomcatのサービスファイルを作成
|
260
|
+
|
261
|
+
vi /etc/systemd/system/tomcat.service
|
262
|
+
|
263
|
+
以下のコードを記述
|
264
|
+
|
265
|
+
[Unit]
|
266
|
+
|
267
|
+
Description=Apache Tomcat 9
|
268
|
+
|
269
|
+
After=network.target
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
[Service]
|
274
|
+
|
275
|
+
User=tomcat
|
276
|
+
|
277
|
+
Group=tomcat
|
278
|
+
|
279
|
+
Type=oneshot
|
280
|
+
|
281
|
+
PIDFile=/opt/tomcat/tomcat.pid
|
282
|
+
|
283
|
+
RemainAfterExit=yes
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
ExecStart=/opt/tomcat/bin/startup.sh
|
288
|
+
|
289
|
+
ExecStop=/opt/tomcat/bin/shutdown.sh ExecReStart=/opt/tomcat/bin/shutdown.sh;/opt/tomcat/bin/startup.sh
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
[Install]
|
294
|
+
|
295
|
+
WantedBy=multi-user.target
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
反映
|
300
|
+
|
301
|
+
systemctl daemon-reload
|
302
|
+
|
303
|
+
自動起動有効
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
systemctl enable tomcat
|
308
|
+
|
309
|
+
user,groupはtomcatに変更
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
chown -R tomcat:tomcat /opt/tomcat
|
314
|
+
|
315
|
+
自動起動の確認
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
reboot
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
tomcatの起動確認
|
324
|
+
|
325
|
+
systemctl status tomcat.service
|
46
326
|
|
47
327
|
● tomcat.service - Apache Tomcat 9
|
48
328
|
|
@@ -72,304 +352,18 @@
|
|
72
352
|
|
73
353
|
|
74
354
|
|
355
|
+
自動起動ができていない
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
systemctl start tomcat
|
360
|
+
|
361
|
+
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
普通の起動もできなくなった
|
366
|
+
|
367
|
+
|
368
|
+
|
75
369
|
---
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
構築した環境、やったこと、起こったこと
|
82
|
-
|
83
|
-
---
|
84
|
-
|
85
|
-
・EC2インスタンスの作成
|
86
|
-
|
87
|
-
amazon Linux 2 AMIを選択
|
88
|
-
|
89
|
-
インスタンスタイプ:t2microを選択
|
90
|
-
|
91
|
-
インスタンスの詳細設定:ネットワーク(vpcデフォルト)、サブネット(アベイラビリティゾーンのデフォルト)、自動割り当てパブリック(サブネット設定を使用)
|
92
|
-
|
93
|
-
ストレージの追加:ボリュームタイプ(ルート)、デバイス(/dev/xvda)、サイズ(8GB)、ボリュームタイプ(汎用SSD(qp2))
|
94
|
-
|
95
|
-
セキュリティグループの設定
|
96
|
-
|
97
|
-
HTTP TCP 80 0.0.0.0/0 -
|
98
|
-
|
99
|
-
HTTP TCP 80 ::/0 -
|
100
|
-
|
101
|
-
カスタム TCP TCP 8080 0.0.0.0/0 -
|
102
|
-
|
103
|
-
SSH TCP 22 0.0.0.0/0 -
|
104
|
-
|
105
|
-
MYSQL/Aurora TCP 3306 0.0.0.0/0 -
|
106
|
-
|
107
|
-
MYSQL/Aurora TCP 3306 ::/0 -
|
108
|
-
|
109
|
-
HTTPS TCP 443 0.0.0.0/0 -
|
110
|
-
|
111
|
-
HTTPS TCP 443 ::/0
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
・TeraTermをインストール
|
118
|
-
|
119
|
-
・EC2に接続
|
120
|
-
|
121
|
-
・mysqlをインストール
|
122
|
-
|
123
|
-
・EC2をRDSに接続
|
124
|
-
|
125
|
-
・Apacheをインストール
|
126
|
-
|
127
|
-
・JDKインストール(java-1.8.0-openjdk java-1.8.0-openjdk-devel )
|
128
|
-
|
129
|
-
・tomcatユーザー作成
|
130
|
-
|
131
|
-
・tomcatのダウンロード(http://ftp.riken.jp/net/apache/tomcat/tomcat-9/v9.0.36/bin/apache-tomcat-9.0.36.tar.gz)
|
132
|
-
|
133
|
-
・tomcatを展開
|
134
|
-
|
135
|
-
・tomcatのシンボリックリンク作成
|
136
|
-
|
137
|
-
ln -s /opt/apache-tomcat-9.0.36 /opt/tomcat
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
・tomcatのログシンボリックリンク作成
|
142
|
-
|
143
|
-
ln -s /opt/apache-tomcat/logs /var/log/tomcat
|
144
|
-
|
145
|
-
chown -h tomcat:tomcat /var/log/tomcat
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
・firewall設定
|
154
|
-
|
155
|
-
firewall-cmd --list-services --zone=public --permanent
|
156
|
-
|
157
|
-
ssh dhcpv6-client
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
vi /etc/firewalld/services/tomcat.xml
|
162
|
-
|
163
|
-
以下のコードを追加
|
164
|
-
|
165
|
-
<?xml version="1.0" encoding="utf-8"?>
|
166
|
-
|
167
|
-
<service>
|
168
|
-
|
169
|
-
<short>Apache Tomcat 9</short>
|
170
|
-
|
171
|
-
<description>Apache Tomcat 9</description>
|
172
|
-
|
173
|
-
<port protocol="tcp" port="8080"/>
|
174
|
-
|
175
|
-
</service>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
・設定を反映
|
180
|
-
|
181
|
-
firewall-cmd --add-service=tomcat --zone=public --permanent
|
182
|
-
|
183
|
-
firewall-cmd --reload
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
・SELinux無効化
|
188
|
-
|
189
|
-
vi /etc/selinux/config
|
190
|
-
|
191
|
-
This file controls the state of SELinux on the system.
|
192
|
-
|
193
|
-
SELINUX= can take one of these three values:
|
194
|
-
|
195
|
-
enforcing - SELinux security policy is enforced.
|
196
|
-
|
197
|
-
permissive - SELinux prints warnings instead of enforcing.
|
198
|
-
|
199
|
-
disabled - No SELinux policy is loaded.
|
200
|
-
|
201
|
-
SELINUX=disabled
|
202
|
-
|
203
|
-
SELINUXTYPE= can take one of three two values:
|
204
|
-
|
205
|
-
targeted - Targeted processes are protected,
|
206
|
-
|
207
|
-
minimum - Modification of targeted policy. Only selected processes are protected.
|
208
|
-
|
209
|
-
mls - Multi Level Security protection.
|
210
|
-
|
211
|
-
SELINUXTYPE=targeted
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
・再起動
|
216
|
-
|
217
|
-
reboot
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
・TomcatとApacheを起動
|
222
|
-
|
223
|
-
systemctl start httpd.service
|
224
|
-
|
225
|
-
systemctl start tomcat.service
|
226
|
-
|
227
|
-
起動確認
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
webアプリケーションマネージャーの設定
|
232
|
-
|
233
|
-
vi /opt/tomcat/conf/tomcat-users.xml
|
234
|
-
|
235
|
-
以下のコードを記述
|
236
|
-
|
237
|
-
<role rolename="manager-gui"/>
|
238
|
-
|
239
|
-
<user username="XXXX" password="XXXX" roles="manager-gui"/>
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
vi /opt/tomcat/webapps/manager/META-INF/context.xml
|
244
|
-
|
245
|
-
以下のコードを記述
|
246
|
-
|
247
|
-
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
|
248
|
-
|
249
|
-
allow="\d+.\d+.\d+.\d+|::1|0:0:0:0:0:0:0:1" />
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
再起動し設定反映
|
254
|
-
|
255
|
-
systemctl restart tomcat
|
256
|
-
|
257
|
-
しかし、webアプリケーションマネージャーを開けない
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
・tomcat自動起動設定
|
264
|
-
|
265
|
-
新規ファイルでtomcatのサービスファイルを作成
|
266
|
-
|
267
|
-
vi /etc/systemd/system/tomcat.service
|
268
|
-
|
269
|
-
以下のコードを記述
|
270
|
-
|
271
|
-
[Unit]
|
272
|
-
|
273
|
-
Description=Apache Tomcat 9
|
274
|
-
|
275
|
-
After=network.target
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
[Service]
|
280
|
-
|
281
|
-
User=tomcat
|
282
|
-
|
283
|
-
Group=tomcat
|
284
|
-
|
285
|
-
Type=oneshot
|
286
|
-
|
287
|
-
PIDFile=/opt/tomcat/tomcat.pid
|
288
|
-
|
289
|
-
RemainAfterExit=yes
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
ExecStart=/opt/tomcat/bin/startup.sh
|
294
|
-
|
295
|
-
ExecStop=/opt/tomcat/bin/shutdown.sh ExecReStart=/opt/tomcat/bin/shutdown.sh;/opt/tomcat/bin/startup.sh
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
[Install]
|
300
|
-
|
301
|
-
WantedBy=multi-user.target
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
反映
|
306
|
-
|
307
|
-
systemctl daemon-reload
|
308
|
-
|
309
|
-
自動起動有効
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
systemctl enable tomcat
|
314
|
-
|
315
|
-
user,groupはtomcatに変更
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
chown -R tomcat:tomcat /opt/tomcat
|
320
|
-
|
321
|
-
自動起動の確認
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
reboot
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
tomcatの起動確認
|
330
|
-
|
331
|
-
systemctl status tomcat.service
|
332
|
-
|
333
|
-
● tomcat.service - Apache Tomcat 9
|
334
|
-
|
335
|
-
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
|
336
|
-
|
337
|
-
Active: failed (Result: exit-code) since Tue 2020-06-30 23:44:57 UTC; 9min ago
|
338
|
-
|
339
|
-
Process: 6534 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC)
|
340
|
-
|
341
|
-
Main PID: 6534 (code=exited, status=203/EXEC)
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: S...
|
346
|
-
|
347
|
-
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[6534]: ...
|
348
|
-
|
349
|
-
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: t...
|
350
|
-
|
351
|
-
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: F...
|
352
|
-
|
353
|
-
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: U...
|
354
|
-
|
355
|
-
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: t...
|
356
|
-
|
357
|
-
Hint: Some lines were ellipsized, use -l to show in full.
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
自動起動ができていない
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
systemctl start tomcat
|
366
|
-
|
367
|
-
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
普通の起動もできなくなった
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
---
|
3
構築した環境、やったこと、起こったことを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -73,3 +73,303 @@
|
|
73
73
|
|
74
74
|
|
75
75
|
---
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
構築した環境、やったこと、起こったこと
|
82
|
+
|
83
|
+
---
|
84
|
+
|
85
|
+
・EC2インスタンスの作成
|
86
|
+
|
87
|
+
amazon Linux 2 AMIを選択
|
88
|
+
|
89
|
+
インスタンスタイプ:t2microを選択
|
90
|
+
|
91
|
+
インスタンスの詳細設定:ネットワーク(vpcデフォルト)、サブネット(アベイラビリティゾーンのデフォルト)、自動割り当てパブリック(サブネット設定を使用)
|
92
|
+
|
93
|
+
ストレージの追加:ボリュームタイプ(ルート)、デバイス(/dev/xvda)、サイズ(8GB)、ボリュームタイプ(汎用SSD(qp2))
|
94
|
+
|
95
|
+
セキュリティグループの設定
|
96
|
+
|
97
|
+
HTTP TCP 80 0.0.0.0/0 -
|
98
|
+
|
99
|
+
HTTP TCP 80 ::/0 -
|
100
|
+
|
101
|
+
カスタム TCP TCP 8080 0.0.0.0/0 -
|
102
|
+
|
103
|
+
SSH TCP 22 0.0.0.0/0 -
|
104
|
+
|
105
|
+
MYSQL/Aurora TCP 3306 0.0.0.0/0 -
|
106
|
+
|
107
|
+
MYSQL/Aurora TCP 3306 ::/0 -
|
108
|
+
|
109
|
+
HTTPS TCP 443 0.0.0.0/0 -
|
110
|
+
|
111
|
+
HTTPS TCP 443 ::/0
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
・TeraTermをインストール
|
118
|
+
|
119
|
+
・EC2に接続
|
120
|
+
|
121
|
+
・mysqlをインストール
|
122
|
+
|
123
|
+
・EC2をRDSに接続
|
124
|
+
|
125
|
+
・Apacheをインストール
|
126
|
+
|
127
|
+
・JDKインストール(java-1.8.0-openjdk java-1.8.0-openjdk-devel )
|
128
|
+
|
129
|
+
・tomcatユーザー作成
|
130
|
+
|
131
|
+
・tomcatのダウンロード(http://ftp.riken.jp/net/apache/tomcat/tomcat-9/v9.0.36/bin/apache-tomcat-9.0.36.tar.gz)
|
132
|
+
|
133
|
+
・tomcatを展開
|
134
|
+
|
135
|
+
・tomcatのシンボリックリンク作成
|
136
|
+
|
137
|
+
ln -s /opt/apache-tomcat-9.0.36 /opt/tomcat
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
・tomcatのログシンボリックリンク作成
|
142
|
+
|
143
|
+
ln -s /opt/apache-tomcat/logs /var/log/tomcat
|
144
|
+
|
145
|
+
chown -h tomcat:tomcat /var/log/tomcat
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
・firewall設定
|
154
|
+
|
155
|
+
firewall-cmd --list-services --zone=public --permanent
|
156
|
+
|
157
|
+
ssh dhcpv6-client
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
vi /etc/firewalld/services/tomcat.xml
|
162
|
+
|
163
|
+
以下のコードを追加
|
164
|
+
|
165
|
+
<?xml version="1.0" encoding="utf-8"?>
|
166
|
+
|
167
|
+
<service>
|
168
|
+
|
169
|
+
<short>Apache Tomcat 9</short>
|
170
|
+
|
171
|
+
<description>Apache Tomcat 9</description>
|
172
|
+
|
173
|
+
<port protocol="tcp" port="8080"/>
|
174
|
+
|
175
|
+
</service>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
・設定を反映
|
180
|
+
|
181
|
+
firewall-cmd --add-service=tomcat --zone=public --permanent
|
182
|
+
|
183
|
+
firewall-cmd --reload
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
・SELinux無効化
|
188
|
+
|
189
|
+
vi /etc/selinux/config
|
190
|
+
|
191
|
+
This file controls the state of SELinux on the system.
|
192
|
+
|
193
|
+
SELINUX= can take one of these three values:
|
194
|
+
|
195
|
+
enforcing - SELinux security policy is enforced.
|
196
|
+
|
197
|
+
permissive - SELinux prints warnings instead of enforcing.
|
198
|
+
|
199
|
+
disabled - No SELinux policy is loaded.
|
200
|
+
|
201
|
+
SELINUX=disabled
|
202
|
+
|
203
|
+
SELINUXTYPE= can take one of three two values:
|
204
|
+
|
205
|
+
targeted - Targeted processes are protected,
|
206
|
+
|
207
|
+
minimum - Modification of targeted policy. Only selected processes are protected.
|
208
|
+
|
209
|
+
mls - Multi Level Security protection.
|
210
|
+
|
211
|
+
SELINUXTYPE=targeted
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
・再起動
|
216
|
+
|
217
|
+
reboot
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
・TomcatとApacheを起動
|
222
|
+
|
223
|
+
systemctl start httpd.service
|
224
|
+
|
225
|
+
systemctl start tomcat.service
|
226
|
+
|
227
|
+
起動確認
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
webアプリケーションマネージャーの設定
|
232
|
+
|
233
|
+
vi /opt/tomcat/conf/tomcat-users.xml
|
234
|
+
|
235
|
+
以下のコードを記述
|
236
|
+
|
237
|
+
<role rolename="manager-gui"/>
|
238
|
+
|
239
|
+
<user username="XXXX" password="XXXX" roles="manager-gui"/>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
vi /opt/tomcat/webapps/manager/META-INF/context.xml
|
244
|
+
|
245
|
+
以下のコードを記述
|
246
|
+
|
247
|
+
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
|
248
|
+
|
249
|
+
allow="\d+.\d+.\d+.\d+|::1|0:0:0:0:0:0:0:1" />
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
再起動し設定反映
|
254
|
+
|
255
|
+
systemctl restart tomcat
|
256
|
+
|
257
|
+
しかし、webアプリケーションマネージャーを開けない
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
・tomcat自動起動設定
|
264
|
+
|
265
|
+
新規ファイルでtomcatのサービスファイルを作成
|
266
|
+
|
267
|
+
vi /etc/systemd/system/tomcat.service
|
268
|
+
|
269
|
+
以下のコードを記述
|
270
|
+
|
271
|
+
[Unit]
|
272
|
+
|
273
|
+
Description=Apache Tomcat 9
|
274
|
+
|
275
|
+
After=network.target
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
[Service]
|
280
|
+
|
281
|
+
User=tomcat
|
282
|
+
|
283
|
+
Group=tomcat
|
284
|
+
|
285
|
+
Type=oneshot
|
286
|
+
|
287
|
+
PIDFile=/opt/tomcat/tomcat.pid
|
288
|
+
|
289
|
+
RemainAfterExit=yes
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
ExecStart=/opt/tomcat/bin/startup.sh
|
294
|
+
|
295
|
+
ExecStop=/opt/tomcat/bin/shutdown.sh ExecReStart=/opt/tomcat/bin/shutdown.sh;/opt/tomcat/bin/startup.sh
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
[Install]
|
300
|
+
|
301
|
+
WantedBy=multi-user.target
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
反映
|
306
|
+
|
307
|
+
systemctl daemon-reload
|
308
|
+
|
309
|
+
自動起動有効
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
systemctl enable tomcat
|
314
|
+
|
315
|
+
user,groupはtomcatに変更
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
chown -R tomcat:tomcat /opt/tomcat
|
320
|
+
|
321
|
+
自動起動の確認
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
reboot
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
tomcatの起動確認
|
330
|
+
|
331
|
+
systemctl status tomcat.service
|
332
|
+
|
333
|
+
● tomcat.service - Apache Tomcat 9
|
334
|
+
|
335
|
+
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
|
336
|
+
|
337
|
+
Active: failed (Result: exit-code) since Tue 2020-06-30 23:44:57 UTC; 9min ago
|
338
|
+
|
339
|
+
Process: 6534 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC)
|
340
|
+
|
341
|
+
Main PID: 6534 (code=exited, status=203/EXEC)
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: S...
|
346
|
+
|
347
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[6534]: ...
|
348
|
+
|
349
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: t...
|
350
|
+
|
351
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: F...
|
352
|
+
|
353
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: U...
|
354
|
+
|
355
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: t...
|
356
|
+
|
357
|
+
Hint: Some lines were ellipsized, use -l to show in full.
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
自動起動ができていない
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
systemctl start tomcat
|
366
|
+
|
367
|
+
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
普通の起動もできなくなった
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
---
|
2
systemctl status tomcat.serviceコマンドを使った時の反応
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,6 +32,44 @@
|
|
32
32
|
|
33
33
|
tomcat起動のコマンドとそれに対するメッセージです。
|
34
34
|
|
35
|
+
---
|
36
|
+
|
35
37
|
[root@ip-***-**-**-** ~]# systemctl start tomcat
|
36
38
|
|
37
39
|
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
[root@ip-***-**-**-** ~]# systemctl status tomcat.service
|
46
|
+
|
47
|
+
● tomcat.service - Apache Tomcat 9
|
48
|
+
|
49
|
+
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
|
50
|
+
|
51
|
+
Active: failed (Result: exit-code) since Tue 2020-06-30 23:44:57 UTC; 9min ago
|
52
|
+
|
53
|
+
Process: 6534 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC)
|
54
|
+
|
55
|
+
Main PID: 6534 (code=exited, status=203/EXEC)
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: S...
|
60
|
+
|
61
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[6534]: ...
|
62
|
+
|
63
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: t...
|
64
|
+
|
65
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: F...
|
66
|
+
|
67
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: U...
|
68
|
+
|
69
|
+
Jun 30 23:44:57 ip-***-**-**-**-33.ap-northeast-1.compute.internal systemd[1]: t...
|
70
|
+
|
71
|
+
Hint: Some lines were ellipsized, use -l to show in full.
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
---
|
1
tomcat起動のコマンドとそれに対するメッセージを記述
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,3 +25,13 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
もしくは、linuxでのエラーの特定の仕方を教えていただけたら幸いです。
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
※2020/07/01 8:46追記
|
32
|
+
|
33
|
+
tomcat起動のコマンドとそれに対するメッセージです。
|
34
|
+
|
35
|
+
[root@ip-***-**-**-** ~]# systemctl start tomcat
|
36
|
+
|
37
|
+
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
|