2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWSのAmazonLinux 2023にtomcat9.0.82をインストールする

Last updated at Posted at 2023-11-07

AmazonLinux2023にTomcat9をインストールする

■Tomcatユーザーの作成

useradd -r -s /sbin/nologin tomcat

■Tomcatのインストール(/root)

cd 
wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.82/bin/apache-tomcat-9.0.82.tar.gz 
tar -zxvf apache-tomcat-9.0.82.tar.gz 
mv apache-tomcat-9.0.82 /usr/local/src/
ln -s /usr/local/src/apache-tomcat-9.0.82/ /usr/local/src/tomcat
chown -R tomcat:tomcat /usr/local/src/apache-tomcat-9.0.82
chown -R tomcat:tomcat /usr/local/src/tomcat

■Tomcat起動設定の記述(/etc/systemd/system/tomcat.service)

/etc/systemd/system/tomcat.service
[Unit]
Description=Tomcat Web Server
After=network.target

[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="CATALINA_BASE=/usr/local/src/tomcat"
Environment="CATALINA_HOME=/usr/local/src/tomcat"
Environment="CATALINA_PID=/usr/local/src/tomcat/temp/tomcat.pid"
ExecStart=/usr/local/src/tomcat/bin/startup.sh
ExecStop=/usr/local/src/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

■tomcatの登録

systemctl daemon-reload
systemctl enable tomcat
systemctl is-enabled tomcat

■~/.bash_profileにパスの記述

vi  ~/.bash_profile
※以下を追記
export CATALINA_HOME=/usr/local/src/tomcat
source ~/.bash_profile
systemctl start tomcat

[AWS側での追加作業]
セキュリティグループのインバウンドルールにポート8080の許可を追加する。
インスタンスのアドレス:8080へアクセスし、ブラウザ上でインストールと動作の確認。
Tomcat 9.0.82が表示されればOK

参考(Tomcat10ですが基本は同じ)
https://dev.34-d.net/install-tomcat-10-1-on-al2023/
https://zenn.dev/lifewithpiano/scraps/d579be009c112b

アプリケーションマネージャの機能を使う場合はこちらも参照
(tomcat-users.xmlの編集、context.xmlの編集2か所)
https://nets-tip.com/?p=1329

2
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?