DockerでのLAMP環境構築手順(Amazon Linux 2/PHP8.1(Laravel9)) ②Apacheの導入(全8回)

# はじめに

かくかくしかじかで、Docker で Amazon Linux 2 ベースの LAMP 環境を構築する機会がありましたので、構築する手順についてアウトプットします。
![スクリーンショット 2022-11-30 23.31.45.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/527226/930bcd24-38e9-316e-bebd-cef83aea5924.png)

全 8 回を予定しています。

[① 作成する環境の確認](https://qiita.com/ryamate/items/47183e1ffd4843ef18fa)
**② Apache の導入**
[③ PHP 8.1 系のインストール](https://qiita.com/ryamate/items/7a38eb11d64d504a7a22)
[④ Composer のインストール](https://qiita.com/ryamate/items/a8bbd003c6c2abceedc9)
[⑤ timezone, locale の設定](https://qiita.com/ryamate/items/d148bcdbdb27c5b80ad8)
[⑥ docker-compose.yml の作成（MySQL の導入）](https://qiita.com/ryamate/items/ac52b152757141f443e3)
[⑦ Laravel 9 系のインストール](https://qiita.com/ryamate/items/79875e22906cfb51af67)
[⑧ Apache の設定ファイルの追加](https://qiita.com/ryamate/items/18747f5241df487ea497)

今回は、 **② Apache の導入** についてです。

## 環境

以下の Docker 環境を構築します。

- Amazon Linux 2
- Apache 2.4
- MySQL 8.0.28
- PHP 8.1.x
- Laravel 9.x



## 目次

[1. Amazon Linux とは](#1-amazon-linux-とは)
[2. Docker イメージの作成](#2-docker-イメージの作成)
[3. Docker コンテナの作成](#3-docker-コンテナの作成)
[4. Apache のインストール](#4-apache-のインストール)
[5. Docker イメージとコンテナの再作成](#5-docker-イメージとコンテナの再作成)

# 1. Amazon Linux とは

Docker Hubで Amazon Linux を検索して、公式のコンテナイメージを確認します。

> Amazon Linux is provided by Amazon Web Services (AWS). It is designed to provide a stable, secure, and high-performance execution environment for applications running on Amazon EC2. The full distribution includes packages that enable easy integration with AWS, including launch configuration tools and many popular AWS libraries and tools. AWS provides ongoing security and maintenance updates to all instances running Amazon Linux.
> 

（Amazon Linuxは、Amazon Web Services（AWS）が提供しています。Amazon EC2上で動作するアプリケーションに対して、安定かつ安全で、高性能な実行環境を提供するために設計されています。フルディストリビューションには、起動設定ツールや多くの一般的なAWSライブラリおよびツールなど、AWSとの容易な統合を可能にするパッケージが含まれています。AWSは、Amazon Linuxを実行しているすべてのインスタンスに対して、継続的なセキュリティとメンテナンスのアップデートを提供します。）
※ DeepL翻訳

https://hub.docker.com/_/amazonlinux#:~:text=Amazon%20Linux%20is,running%20Amazon%20Linux

# 2. Docker イメージの作成

Docker イメージを作成します。

## 2-1. 作業ディレクトリの作成

作業するディレクトリを作成します。

```bash:ターミナル
# r_yamate @ mbp in ~ [22:16:11]
$ cd ~/Documents/code/

# r_yamate @ mbp in ~/Documents/code [22:16:24]
$ mkdir advent-calendar

# r_yamate @ mbp in ~/Documents/code [22:16:41]
$ cd advent-calendar

# r_yamate @ mbp in ~/Documents/code/advent-calendar [22:16:56]
$ pwd
/Users/r_yamate/Documents/code/advent-calendar
```

## 2-2. Dockerfile の新規作成

Dockerfile を新規作成・編集します。

```docker:Dockerfile
FROM amazonlinux:2
```

## 2-3. イメージの作成

**Dockerfile** から、イメージを作成します。

```bash:ターミナル
docker image build -t advent-calendar/advent-calendar:latest . 
```

<details><summary>コマンド実行結果</summary>

```bash
# r_yamate @ mbp in ~/Documents/code/advent-calendar [6:54:05] C:1
$ docker image build -t advent-calendar/advent-calendar:latest .
[+] Building 22.9s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                       0.0s
 => => transferring dockerfile: 61B                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                                                                            0.0s
 => [internal] load metadata for docker.io/library/amazonlinux:2                                                                                                                                           4.5s
 => [1/1] FROM docker.io/library/amazonlinux:2@sha256:f0ad031d65bf6cd219d8621d2a304d884c6a809ca2b20855eac371df92f4fcaf                                                                                    18.2s
 => => resolve docker.io/library/amazonlinux:2@sha256:f0ad031d65bf6cd219d8621d2a304d884c6a809ca2b20855eac371df92f4fcaf                                                                                     0.0s
 => => sha256:f0ad031d65bf6cd219d8621d2a304d884c6a809ca2b20855eac371df92f4fcaf 547B / 547B                                                                                                                 0.0s
 => => sha256:37b666a59e80b8b0c78f8e3396c944fe4cf0a1ba27e3d6d93324d3f57a2cfeb5 529B / 529B                                                                                                                 0.0s
 => => sha256:24608685b402b0a8ac1bdc9a1f7c662e5b88dd4620037bea8d7501cd3b2508bc 1.48kB / 1.48kB                                                                                                             0.0s
 => => sha256:e3cfe889ce0a44ace07ec174bd2a7e9022e493956fba0069812a53f81a6040e2 62.31MB / 62.31MB                                                                                                          13.7s
 => => extracting sha256:e3cfe889ce0a44ace07ec174bd2a7e9022e493956fba0069812a53f81a6040e2                                                                                                                  3.7s
 => exporting to image                                                                                                                                                                                     0.0s
 => => exporting layers                                                                                                                                                                                    0.0s
 => => writing image sha256:11023cab22edfc037cef6936698323ad7db5d62d94e6031cf3913a512d27bf30                                                                                                               0.0s
 => => naming to docker.io/advent-calendar/advent-calendar:latest
```

</details>

- `-t`でタグを指定します。
- `.`（カレントディレクトリ）を指定すると、そこにある `Dockerfile` （先程作成した）が参照されます。

作成されたイメージを確認します。

```bash:ターミナル
docker image ls
```

<details><summary>実行時ログ</summary>

```bash
# r_yamate @ mbp in ~/Documents/code/advent-calendar [6:55:35]
$ docker image ls
REPOSITORY                           TAG       IMAGE ID       CREATED         SIZE
advent-calendar                      latest    11023cab22ed   2 weeks ago     164MB
(以下、省略)
```

</details>

# 3. Docker コンテナの作成

## 3-1. コンテナの作成・起動

コンテナを作成・起動します。

```bash:ターミナル
docker container run -it -d --name advent-calendar -p 8080:80 advent-calendar/advent-calendar:latest
```

<details><summary>実行時ログ</summary>

```bash
# r_yamate @ mbp in ~/Documents/code/advent-calendar [7:13:11]
$ docker container run -it -d --name advent-calendar -p 8080:80 advent-calendar/advent-calendar:latest
0b8dd9cc00c9ee686affbb53a6355f77bc143834aaa25278a954be8a11c518dc
```

```bash
# r_yamate @ mbp in ~/Documents/code/advent-calendar [7:17:52]
$ docker container ls
CONTAINER ID   IMAGE                                    COMMAND       CREATED          STATUS          PORTS                  NAMES
0b8dd9cc00c9   advent-calendar/advent-calendar:latest   "/bin/bash"   42 seconds ago   Up 40 seconds   0.0.0.0:8080->80/tcp   advent-calendar
```

</details>

## 3-2. Docker コンテナでのシェルの実行

Dockerコンテナの中に入ります。

```bash:ターミナル
docker container exec -it advent-calendar /bin/bash
```

- 実行時ログ

  ```bash
  # r_yamate @ mbp in ~/Documents/code/advent-calendar [5:43:38]
  $ docker container exec -it advent-calendar /bin/bash
  bash-4.2#
  ```

</details>

入力行に `bash-4.2#` と表示されていれば、Dockerコンテナの中に入っています。以降、シェルを Docker コンテナで実行します。

# 4. Apache のインストール

Amazon Linux 2 に Apache をインストールします。

## 4-1. yum のアップデート

パッケージ管理ツール yum をアップデートします。

### yum とは

> 「Yum（Yellowdog Updater Modified/ ヤム）」とは、LinuxのRedHat系ディストリビューション（CentOSやFedoraなど）で利用されるパッケージ管理ツールです。Debian系ディストリビューション（Ubuntuなど）で利用される「APT」に相当するものです。
> 

https://uxmilk.jp/9715

### Amazon Linux 2 のパッケージ管理ツールは yum でいいのか

> RHEL7 / CentOS7 をベースとしていると言われております。Systemd が採用されていることからも、実際の操作は RHEL7/CentOS7 に近いです。

https://www.acrovision.jp/service/aws/?p=653

ということで、手順を調べる際には、 CentOS7 に関する記事などを参考にして進めました。

yumをアップデートします。

```bash:ターミナル(Dockerコンテナ内)
yum update
```

<details><summary>実行時ログ</summary>

```bash
bash-4.2# yum update
Loaded plugins: ovl, priorities
amzn2-core                                                                                                                                                                               | 3.7 kB  00:00:00
(1/3): amzn2-core/2/x86_64/group_gz                                                                                                                                                      | 2.5 kB  00:00:00
(2/3): amzn2-core/2/x86_64/updateinfo                                                                                                                                                    | 525 kB  00:00:00
(3/3): amzn2-core/2/x86_64/primary_db                                                                                                                                                    |  66 MB  00:00:09
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.79.1-4.amzn2.0.1 will be updated
---> Package curl.x86_64 0:7.79.1-6.amzn2.0.1 will be an update
---> Package expat.x86_64 0:2.1.0-14.amzn2.0.1 will be updated
---> Package expat.x86_64 0:2.1.0-15.amzn2.0.1 will be an update
---> Package glibc.x86_64 0:2.26-60.amzn2 will be updated
---> Package glibc.x86_64 0:2.26-62.amzn2 will be an update
---> Package glibc-common.x86_64 0:2.26-60.amzn2 will be updated
---> Package glibc-common.x86_64 0:2.26-62.amzn2 will be an update
---> Package glibc-langpack-en.x86_64 0:2.26-60.amzn2 will be updated
---> Package glibc-langpack-en.x86_64 0:2.26-62.amzn2 will be an update
---> Package glibc-minimal-langpack.x86_64 0:2.26-60.amzn2 will be updated
---> Package glibc-minimal-langpack.x86_64 0:2.26-62.amzn2 will be an update
---> Package libblkid.x86_64 0:2.30.2-2.amzn2.0.7 will be updated
---> Package libblkid.x86_64 0:2.30.2-2.amzn2.0.9 will be an update
---> Package libcrypt.x86_64 0:2.26-60.amzn2 will be updated
---> Package libcrypt.x86_64 0:2.26-62.amzn2 will be an update
---> Package libcurl.x86_64 0:7.79.1-4.amzn2.0.1 will be updated
---> Package libcurl.x86_64 0:7.79.1-6.amzn2.0.1 will be an update
---> Package libmount.x86_64 0:2.30.2-2.amzn2.0.7 will be updated
---> Package libmount.x86_64 0:2.30.2-2.amzn2.0.9 will be an update
---> Package libuuid.x86_64 0:2.30.2-2.amzn2.0.7 will be updated
---> Package libuuid.x86_64 0:2.30.2-2.amzn2.0.9 will be an update
---> Package tzdata.noarch 0:2022d-1.amzn2.0.1 will be updated
---> Package tzdata.noarch 0:2022e-1.amzn2.0.1 will be an update
---> Package vim-data.noarch 2:8.2.5172-1.amzn2.0.1 will be updated
---> Package vim-data.noarch 2:9.0.475-1.amzn2.0.1 will be an update
---> Package vim-minimal.x86_64 2:8.2.5172-1.amzn2.0.1 will be updated
---> Package vim-minimal.x86_64 2:9.0.475-1.amzn2.0.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================
 Package                                                  Arch                                     Version                                                   Repository                                    Size
================================================================================================================================================================================================================
Updating:
 curl                                                     x86_64                                   7.79.1-6.amzn2.0.1                                        amzn2-core                                   360 k
 expat                                                    x86_64                                   2.1.0-15.amzn2.0.1                                        amzn2-core                                    89 k
 glibc                                                    x86_64                                   2.26-62.amzn2                                             amzn2-core                                   3.3 M
 glibc-common                                             x86_64                                   2.26-62.amzn2                                             amzn2-core                                   774 k
 glibc-langpack-en                                        x86_64                                   2.26-62.amzn2                                             amzn2-core                                   289 k
 glibc-minimal-langpack                                   x86_64                                   2.26-62.amzn2                                             amzn2-core                                    33 k
 libblkid                                                 x86_64                                   2.30.2-2.amzn2.0.9                                        amzn2-core                                   190 k
 libcrypt                                                 x86_64                                   2.26-62.amzn2                                             amzn2-core                                    53 k
 libcurl                                                  x86_64                                   7.79.1-6.amzn2.0.1                                        amzn2-core                                   322 k
 libmount                                                 x86_64                                   2.30.2-2.amzn2.0.9                                        amzn2-core                                   213 k
 libuuid                                                  x86_64                                   2.30.2-2.amzn2.0.9                                        amzn2-core                                    79 k
 tzdata                                                   noarch                                   2022e-1.amzn2.0.1                                         amzn2-core                                   481 k
 vim-data                                                 noarch                                   2:9.0.475-1.amzn2.0.1                                     amzn2-core                                    77 k
 vim-minimal                                              x86_64                                   2:9.0.475-1.amzn2.0.1                                     amzn2-core                                   723 k

Transaction Summary
================================================================================================================================================================================================================
Upgrade  14 Packages

Total download size: 6.9 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/14): expat-2.1.0-15.amzn2.0.1.x86_64.rpm                                                                                                                                              |  89 kB  00:00:00
(2/14): curl-7.79.1-6.amzn2.0.1.x86_64.rpm                                                                                                                                               | 360 kB  00:00:00
(3/14): glibc-common-2.26-62.amzn2.x86_64.rpm                                                                                                                                            | 774 kB  00:00:00
(4/14): glibc-langpack-en-2.26-62.amzn2.x86_64.rpm                                                                                                                                       | 289 kB  00:00:00
(5/14): glibc-minimal-langpack-2.26-62.amzn2.x86_64.rpm                                                                                                                                  |  33 kB  00:00:00
(6/14): libblkid-2.30.2-2.amzn2.0.9.x86_64.rpm                                                                                                                                           | 190 kB  00:00:00
(7/14): libcrypt-2.26-62.amzn2.x86_64.rpm                                                                                                                                                |  53 kB  00:00:00
(8/14): libcurl-7.79.1-6.amzn2.0.1.x86_64.rpm                                                                                                                                            | 322 kB  00:00:00
(9/14): libmount-2.30.2-2.amzn2.0.9.x86_64.rpm                                                                                                                                           | 213 kB  00:00:00
(10/14): libuuid-2.30.2-2.amzn2.0.9.x86_64.rpm                                                                                                                                           |  79 kB  00:00:00
(11/14): tzdata-2022e-1.amzn2.0.1.noarch.rpm                                                                                                                                             | 481 kB  00:00:00
(12/14): glibc-2.26-62.amzn2.x86_64.rpm                                                                                                                                                  | 3.3 MB  00:00:01
(13/14): vim-data-9.0.475-1.amzn2.0.1.noarch.rpm                                                                                                                                         |  77 kB  00:00:00
(14/14): vim-minimal-9.0.475-1.amzn2.0.1.x86_64.rpm                                                                                                                                      | 723 kB  00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                           3.0 MB/s | 6.9 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 2:vim-data-9.0.475-1.amzn2.0.1.noarch                                                                                                                                                       1/28
  Updating   : tzdata-2022e-1.amzn2.0.1.noarch                                                                                                                                                             2/28
  Updating   : glibc-common-2.26-62.amzn2.x86_64                                                                                                                                                           3/28
  Updating   : glibc-minimal-langpack-2.26-62.amzn2.x86_64                                                                                                                                                 4/28
  Updating   : glibc-2.26-62.amzn2.x86_64                                                                                                                                                                  5/28
  Updating   : libuuid-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                           6/28
  Updating   : libblkid-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                          7/28
  Updating   : libcurl-7.79.1-6.amzn2.0.1.x86_64                                                                                                                                                           8/28
  Updating   : curl-7.79.1-6.amzn2.0.1.x86_64                                                                                                                                                              9/28
  Updating   : libmount-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                         10/28
  Updating   : libcrypt-2.26-62.amzn2.x86_64                                                                                                                                                              11/28
  Updating   : expat-2.1.0-15.amzn2.0.1.x86_64                                                                                                                                                            12/28
  Updating   : 2:vim-minimal-9.0.475-1.amzn2.0.1.x86_64                                                                                                                                                   13/28
  Updating   : glibc-langpack-en-2.26-62.amzn2.x86_64                                                                                                                                                     14/28
  Cleanup    : libmount-2.30.2-2.amzn2.0.7.x86_64                                                                                                                                                         15/28
  Cleanup    : libblkid-2.30.2-2.amzn2.0.7.x86_64                                                                                                                                                         16/28
  Cleanup    : curl-7.79.1-4.amzn2.0.1.x86_64                                                                                                                                                             17/28
  Cleanup    : glibc-langpack-en-2.26-60.amzn2.x86_64                                                                                                                                                     18/28
  Cleanup    : 2:vim-minimal-8.2.5172-1.amzn2.0.1.x86_64                                                                                                                                                  19/28
  Cleanup    : libcurl-7.79.1-4.amzn2.0.1.x86_64                                                                                                                                                          20/28
  Cleanup    : libuuid-2.30.2-2.amzn2.0.7.x86_64                                                                                                                                                          21/28
  Cleanup    : expat-2.1.0-14.amzn2.0.1.x86_64                                                                                                                                                            22/28
  Cleanup    : libcrypt-2.26-60.amzn2.x86_64                                                                                                                                                              23/28
  Cleanup    : 2:vim-data-8.2.5172-1.amzn2.0.1.noarch                                                                                                                                                     24/28
  Cleanup    : glibc-common-2.26-60.amzn2.x86_64                                                                                                                                                          25/28
  Cleanup    : glibc-minimal-langpack-2.26-60.amzn2.x86_64                                                                                                                                                26/28
  Cleanup    : glibc-2.26-60.amzn2.x86_64                                                                                                                                                                 27/28
  Cleanup    : tzdata-2022d-1.amzn2.0.1.noarch                                                                                                                                                            28/28
  Verifying  : glibc-2.26-62.amzn2.x86_64                                                                                                                                                                  1/28
  Verifying  : tzdata-2022e-1.amzn2.0.1.noarch                                                                                                                                                             2/28
  Verifying  : libblkid-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                          3/28
  Verifying  : libuuid-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                           4/28
  Verifying  : 2:vim-data-9.0.475-1.amzn2.0.1.noarch                                                                                                                                                       5/28
  Verifying  : libcrypt-2.26-62.amzn2.x86_64                                                                                                                                                               6/28
  Verifying  : curl-7.79.1-6.amzn2.0.1.x86_64                                                                                                                                                              7/28
  Verifying  : libmount-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                          8/28
  Verifying  : libcurl-7.79.1-6.amzn2.0.1.x86_64                                                                                                                                                           9/28
  Verifying  : expat-2.1.0-15.amzn2.0.1.x86_64                                                                                                                                                            10/28
  Verifying  : glibc-common-2.26-62.amzn2.x86_64                                                                                                                                                          11/28
  Verifying  : 2:vim-minimal-9.0.475-1.amzn2.0.1.x86_64                                                                                                                                                   12/28
  Verifying  : glibc-langpack-en-2.26-62.amzn2.x86_64                                                                                                                                                     13/28
  Verifying  : glibc-minimal-langpack-2.26-62.amzn2.x86_64                                                                                                                                                14/28
  Verifying  : libblkid-2.30.2-2.amzn2.0.7.x86_64                                                                                                                                                         15/28
  Verifying  : libcurl-7.79.1-4.amzn2.0.1.x86_64                                                                                                                                                          16/28
  Verifying  : expat-2.1.0-14.amzn2.0.1.x86_64                                                                                                                                                            17/28
  Verifying  : curl-7.79.1-4.amzn2.0.1.x86_64                                                                                                                                                             18/28
  Verifying  : libuuid-2.30.2-2.amzn2.0.7.x86_64                                                                                                                                                          19/28
  Verifying  : glibc-langpack-en-2.26-60.amzn2.x86_64                                                                                                                                                     20/28
  Verifying  : glibc-minimal-langpack-2.26-60.amzn2.x86_64                                                                                                                                                21/28
  Verifying  : glibc-2.26-60.amzn2.x86_64                                                                                                                                                                 22/28
  Verifying  : 2:vim-minimal-8.2.5172-1.amzn2.0.1.x86_64                                                                                                                                                  23/28
  Verifying  : tzdata-2022d-1.amzn2.0.1.noarch                                                                                                                                                            24/28
  Verifying  : glibc-common-2.26-60.amzn2.x86_64                                                                                                                                                          25/28
  Verifying  : libmount-2.30.2-2.amzn2.0.7.x86_64                                                                                                                                                         26/28
  Verifying  : 2:vim-data-8.2.5172-1.amzn2.0.1.noarch                                                                                                                                                     27/28
  Verifying  : libcrypt-2.26-60.amzn2.x86_64                                                                                                                                                              28/28

Updated:
  curl.x86_64 0:7.79.1-6.amzn2.0.1              expat.x86_64 0:2.1.0-15.amzn2.0.1    glibc.x86_64 0:2.26-62.amzn2          glibc-common.x86_64 0:2.26-62.amzn2      glibc-langpack-en.x86_64 0:2.26-62.amzn2
  glibc-minimal-langpack.x86_64 0:2.26-62.amzn2 libblkid.x86_64 0:2.30.2-2.amzn2.0.9 libcrypt.x86_64 0:2.26-62.amzn2       libcurl.x86_64 0:7.79.1-6.amzn2.0.1      libmount.x86_64 0:2.30.2-2.amzn2.0.9
  libuuid.x86_64 0:2.30.2-2.amzn2.0.9           tzdata.noarch 0:2022e-1.amzn2.0.1    vim-data.noarch 2:9.0.475-1.amzn2.0.1 vim-minimal.x86_64 2:9.0.475-1.amzn2.0.1

Complete!
```

</details>

`Is this ok [y/d/N]:` と聞かれるため、 Dockerfile では、 `-y` オプションをつけます。

## 4-2. Apache のインストール

Apache をインストールします。`-y`オプションをつけておきます。

```bash:ターミナル(Dockerコンテナ内)
yum install -y httpd
```

<details><summary>実行時ログ(インストール成功)</summary>

```bash
bash-4.2# yum install -y httpd
Loaded plugins: ovl, priorities
amzn2-core                                                                                                                                                                               | 3.7 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.54-1.amzn2 will be installed
--> Processing Dependency: httpd-tools = 2.4.54-1.amzn2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem = 2.4.54-1.amzn2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: systemd-units for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: systemd-units for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: systemd-units for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: system-logos-httpd for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: mod_http2 for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libsystemd.so.0(LIBSYSTEMD_209)(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libsystemd.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.54-1.amzn2.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.7.0-9.amzn2 will be installed
---> Package apr-util.x86_64 0:1.6.1-5.amzn2.0.2 will be installed
--> Processing Dependency: apr-util-bdb(x86-64) = 1.6.1-5.amzn2.0.2 for package: apr-util-1.6.1-5.amzn2.0.2.x86_64
---> Package generic-logos-httpd.noarch 0:18.0.0-4.amzn2 will be installed
---> Package httpd-filesystem.noarch 0:2.4.54-1.amzn2 will be installed
--> Processing Dependency: /usr/sbin/useradd for package: httpd-filesystem-2.4.54-1.amzn2.noarch
---> Package httpd-tools.x86_64 0:2.4.54-1.amzn2 will be installed
---> Package mailcap.noarch 0:2.1.41-2.amzn2 will be installed
---> Package mod_http2.x86_64 0:1.15.19-1.amzn2.0.1 will be installed
---> Package systemd.x86_64 0:219-78.amzn2.0.20 will be installed
--> Processing Dependency: kmod >= 18-4 for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libpam.so.0(LIBPAM_1.0)(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libkmod.so.2(LIBKMOD_5)(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.158)(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.130)(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.122)(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libcryptsetup.so.4(CRYPTSETUP_1.0)(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: dbus for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: acl for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libqrencode.so.3()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libpam.so.0()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: liblz4.so.1()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libkmod.so.2()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libdw.so.1()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libcryptsetup.so.4()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
--> Processing Dependency: libaudit.so.1()(64bit) for package: systemd-219-78.amzn2.0.20.x86_64
---> Package systemd-libs.x86_64 0:219-78.amzn2.0.20 will be installed
--> Running transaction check
---> Package acl.x86_64 0:2.2.51-14.amzn2 will be installed
---> Package apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2 will be installed
---> Package audit-libs.x86_64 0:2.8.1-3.amzn2.1 will be installed
--> Processing Dependency: libcap-ng.so.0()(64bit) for package: audit-libs-2.8.1-3.amzn2.1.x86_64
---> Package cryptsetup-libs.x86_64 0:1.7.4-4.amzn2 will be installed
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_97)(64bit) for package: cryptsetup-libs-1.7.4-4.amzn2.x86_64
--> Processing Dependency: libdevmapper.so.1.02(Base)(64bit) for package: cryptsetup-libs-1.7.4-4.amzn2.x86_64
--> Processing Dependency: libdevmapper.so.1.02()(64bit) for package: cryptsetup-libs-1.7.4-4.amzn2.x86_64
---> Package dbus.x86_64 1:1.10.24-7.amzn2.0.2 will be installed
--> Processing Dependency: dbus-libs(x86-64) = 1:1.10.24-7.amzn2.0.2 for package: 1:dbus-1.10.24-7.amzn2.0.2.x86_64
--> Processing Dependency: libdbus-1.so.3(LIBDBUS_PRIVATE_1.10.24)(64bit) for package: 1:dbus-1.10.24-7.amzn2.0.2.x86_64
--> Processing Dependency: libdbus-1.so.3(LIBDBUS_1_3)(64bit) for package: 1:dbus-1.10.24-7.amzn2.0.2.x86_64
--> Processing Dependency: libdbus-1.so.3()(64bit) for package: 1:dbus-1.10.24-7.amzn2.0.2.x86_64
---> Package elfutils-libs.x86_64 0:0.176-2.amzn2 will be installed
--> Processing Dependency: default-yama-scope for package: elfutils-libs-0.176-2.amzn2.x86_64
---> Package kmod.x86_64 0:25-3.amzn2.0.2 will be installed
---> Package kmod-libs.x86_64 0:25-3.amzn2.0.2 will be installed
---> Package lz4.x86_64 0:1.7.5-2.amzn2.0.1 will be installed
---> Package pam.x86_64 0:1.1.8-23.amzn2.0.1 will be installed
--> Processing Dependency: libpwquality >= 0.9.9 for package: pam-1.1.8-23.amzn2.0.1.x86_64
--> Processing Dependency: cracklib-dicts >= 2.8 for package: pam-1.1.8-23.amzn2.0.1.x86_64
--> Processing Dependency: libcrack.so.2()(64bit) for package: pam-1.1.8-23.amzn2.0.1.x86_64
---> Package qrencode-libs.x86_64 0:3.4.1-3.amzn2.0.2 will be installed
---> Package shadow-utils.x86_64 2:4.1.5.1-24.amzn2.0.2 will be installed
--> Processing Dependency: libsemanage.so.1(LIBSEMANAGE_1.0)(64bit) for package: 2:shadow-utils-4.1.5.1-24.amzn2.0.2.x86_64
--> Processing Dependency: libsemanage.so.1()(64bit) for package: 2:shadow-utils-4.1.5.1-24.amzn2.0.2.x86_64
--> Running transaction check
---> Package cracklib.x86_64 0:2.9.0-11.amzn2.0.2 will be installed
--> Processing Dependency: gzip for package: cracklib-2.9.0-11.amzn2.0.2.x86_64
---> Package cracklib-dicts.x86_64 0:2.9.0-11.amzn2.0.2 will be installed
---> Package dbus-libs.x86_64 1:1.10.24-7.amzn2.0.2 will be installed
---> Package device-mapper-libs.x86_64 7:1.02.170-6.amzn2.5 will be installed
--> Processing Dependency: device-mapper = 7:1.02.170-6.amzn2.5 for package: 7:device-mapper-libs-1.02.170-6.amzn2.5.x86_64
---> Package elfutils-default-yama-scope.noarch 0:0.176-2.amzn2 will be installed
---> Package libcap-ng.x86_64 0:0.7.5-4.amzn2.0.4 will be installed
---> Package libpwquality.x86_64 0:1.2.3-5.amzn2 will be installed
---> Package libsemanage.x86_64 0:2.5-11.amzn2 will be installed
--> Processing Dependency: libustr-1.0.so.1(USTR_1.0.1)(64bit) for package: libsemanage-2.5-11.amzn2.x86_64
--> Processing Dependency: libustr-1.0.so.1(USTR_1.0)(64bit) for package: libsemanage-2.5-11.amzn2.x86_64
--> Processing Dependency: libustr-1.0.so.1()(64bit) for package: libsemanage-2.5-11.amzn2.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.170-6.amzn2.5 will be installed
--> Processing Dependency: util-linux >= 2.23 for package: 7:device-mapper-1.02.170-6.amzn2.5.x86_64
---> Package gzip.x86_64 0:1.5-10.amzn2.0.1 will be installed
---> Package ustr.x86_64 0:1.0.4-16.amzn2.0.3 will be installed
--> Running transaction check
---> Package util-linux.x86_64 0:2.30.2-2.amzn2.0.9 will be installed
--> Processing Dependency: libsmartcols = 2.30.2-2.amzn2.0.9 for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk = 2.30.2-2.amzn2.0.9 for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libutempter.so.0(UTEMPTER_1.1)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libsmartcols.so.1(SMARTCOLS_2.30)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libsmartcols.so.1(SMARTCOLS_2.29)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libsmartcols.so.1(SMARTCOLS_2.28)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libsmartcols.so.1(SMARTCOLS_2.27)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libsmartcols.so.1(SMARTCOLS_2.25)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk.so.1(FDISK_2.30)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk.so.1(FDISK_2.29)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk.so.1(FDISK_2.28)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk.so.1(FDISK_2.27)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk.so.1(FDISK_2.26)(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libutempter.so.0()(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libsmartcols.so.1()(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Processing Dependency: libfdisk.so.1()(64bit) for package: util-linux-2.30.2-2.amzn2.0.9.x86_64
--> Running transaction check
---> Package libfdisk.x86_64 0:2.30.2-2.amzn2.0.9 will be installed
---> Package libsmartcols.x86_64 0:2.30.2-2.amzn2.0.9 will be installed
---> Package libutempter.x86_64 0:1.1.6-4.amzn2.0.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================
 Package                                                      Arch                                    Version                                                 Repository                                   Size
================================================================================================================================================================================================================
Installing:
 httpd                                                        x86_64                                  2.4.54-1.amzn2                                          amzn2-core                                  1.4 M
Installing for dependencies:
 acl                                                          x86_64                                  2.2.51-14.amzn2                                         amzn2-core                                   82 k
 apr                                                          x86_64                                  1.7.0-9.amzn2                                           amzn2-core                                  122 k
 apr-util                                                     x86_64                                  1.6.1-5.amzn2.0.2                                       amzn2-core                                   99 k
 apr-util-bdb                                                 x86_64                                  1.6.1-5.amzn2.0.2                                       amzn2-core                                   19 k
 audit-libs                                                   x86_64                                  2.8.1-3.amzn2.1                                         amzn2-core                                   99 k
 cracklib                                                     x86_64                                  2.9.0-11.amzn2.0.2                                      amzn2-core                                   80 k
 cracklib-dicts                                               x86_64                                  2.9.0-11.amzn2.0.2                                      amzn2-core                                  3.6 M
 cryptsetup-libs                                              x86_64                                  1.7.4-4.amzn2                                           amzn2-core                                  224 k
 dbus                                                         x86_64                                  1:1.10.24-7.amzn2.0.2                                   amzn2-core                                  245 k
 dbus-libs                                                    x86_64                                  1:1.10.24-7.amzn2.0.2                                   amzn2-core                                  167 k
 device-mapper                                                x86_64                                  7:1.02.170-6.amzn2.5                                    amzn2-core                                  297 k
 device-mapper-libs                                           x86_64                                  7:1.02.170-6.amzn2.5                                    amzn2-core                                  326 k
 elfutils-default-yama-scope                                  noarch                                  0.176-2.amzn2                                           amzn2-core                                   33 k
 elfutils-libs                                                x86_64                                  0.176-2.amzn2                                           amzn2-core                                  293 k
 generic-logos-httpd                                          noarch                                  18.0.0-4.amzn2                                          amzn2-core                                   19 k
 gzip                                                         x86_64                                  1.5-10.amzn2.0.1                                        amzn2-core                                  129 k
 httpd-filesystem                                             noarch                                  2.4.54-1.amzn2                                          amzn2-core                                   24 k
 httpd-tools                                                  x86_64                                  2.4.54-1.amzn2                                          amzn2-core                                   88 k
 kmod                                                         x86_64                                  25-3.amzn2.0.2                                          amzn2-core                                  111 k
 kmod-libs                                                    x86_64                                  25-3.amzn2.0.2                                          amzn2-core                                   59 k
 libcap-ng                                                    x86_64                                  0.7.5-4.amzn2.0.4                                       amzn2-core                                   25 k
 libfdisk                                                     x86_64                                  2.30.2-2.amzn2.0.9                                      amzn2-core                                  238 k
 libpwquality                                                 x86_64                                  1.2.3-5.amzn2                                           amzn2-core                                   84 k
 libsemanage                                                  x86_64                                  2.5-11.amzn2                                            amzn2-core                                  152 k
 libsmartcols                                                 x86_64                                  2.30.2-2.amzn2.0.9                                      amzn2-core                                  155 k
 libutempter                                                  x86_64                                  1.1.6-4.amzn2.0.2                                       amzn2-core                                   25 k
 lz4                                                          x86_64                                  1.7.5-2.amzn2.0.1                                       amzn2-core                                   99 k
 mailcap                                                      noarch                                  2.1.41-2.amzn2                                          amzn2-core                                   31 k
 mod_http2                                                    x86_64                                  1.15.19-1.amzn2.0.1                                     amzn2-core                                  149 k
 pam                                                          x86_64                                  1.1.8-23.amzn2.0.1                                      amzn2-core                                  715 k
 qrencode-libs                                                x86_64                                  3.4.1-3.amzn2.0.2                                       amzn2-core                                   50 k
 shadow-utils                                                 x86_64                                  2:4.1.5.1-24.amzn2.0.2                                  amzn2-core                                  1.1 M
 systemd                                                      x86_64                                  219-78.amzn2.0.20                                       amzn2-core                                  5.0 M
 systemd-libs                                                 x86_64                                  219-78.amzn2.0.20                                       amzn2-core                                  409 k
 ustr                                                         x86_64                                  1.0.4-16.amzn2.0.3                                      amzn2-core                                   96 k
 util-linux                                                   x86_64                                  2.30.2-2.amzn2.0.9                                      amzn2-core                                  2.3 M

Transaction Summary
================================================================================================================================================================================================================
Install  1 Package (+36 Dependent packages)

Total download size: 18 M
Installed size: 60 M
Downloading packages:
(1/37): acl-2.2.51-14.amzn2.x86_64.rpm                                                                                                                                                   |  82 kB  00:00:00
(2/37): apr-1.7.0-9.amzn2.x86_64.rpm                                                                                                                                                     | 122 kB  00:00:00
(3/37): apr-util-1.6.1-5.amzn2.0.2.x86_64.rpm                                                                                                                                            |  99 kB  00:00:00
(4/37): apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64.rpm                                                                                                                                        |  19 kB  00:00:00
(5/37): audit-libs-2.8.1-3.amzn2.1.x86_64.rpm                                                                                                                                            |  99 kB  00:00:00
(6/37): cracklib-2.9.0-11.amzn2.0.2.x86_64.rpm                                                                                                                                           |  80 kB  00:00:00
(7/37): cryptsetup-libs-1.7.4-4.amzn2.x86_64.rpm                                                                                                                                         | 224 kB  00:00:00
(8/37): dbus-1.10.24-7.amzn2.0.2.x86_64.rpm                                                                                                                                              | 245 kB  00:00:00
(9/37): dbus-libs-1.10.24-7.amzn2.0.2.x86_64.rpm                                                                                                                                         | 167 kB  00:00:00
(10/37): device-mapper-1.02.170-6.amzn2.5.x86_64.rpm                                                                                                                                     | 297 kB  00:00:00
(11/37): device-mapper-libs-1.02.170-6.amzn2.5.x86_64.rpm                                                                                                                                | 326 kB  00:00:00
(12/37): elfutils-default-yama-scope-0.176-2.amzn2.noarch.rpm                                                                                                                            |  33 kB  00:00:00
(13/37): cracklib-dicts-2.9.0-11.amzn2.0.2.x86_64.rpm                                                                                                                                    | 3.6 MB  00:00:01
(14/37): generic-logos-httpd-18.0.0-4.amzn2.noarch.rpm                                                                                                                                   |  19 kB  00:00:00
(15/37): elfutils-libs-0.176-2.amzn2.x86_64.rpm                                                                                                                                          | 293 kB  00:00:00
(16/37): gzip-1.5-10.amzn2.0.1.x86_64.rpm                                                                                                                                                | 129 kB  00:00:00
(17/37): httpd-filesystem-2.4.54-1.amzn2.noarch.rpm                                                                                                                                      |  24 kB  00:00:00
(18/37): httpd-tools-2.4.54-1.amzn2.x86_64.rpm                                                                                                                                           |  88 kB  00:00:00
(19/37): kmod-25-3.amzn2.0.2.x86_64.rpm                                                                                                                                                  | 111 kB  00:00:00
(20/37): kmod-libs-25-3.amzn2.0.2.x86_64.rpm                                                                                                                                             |  59 kB  00:00:00
(21/37): libcap-ng-0.7.5-4.amzn2.0.4.x86_64.rpm                                                                                                                                          |  25 kB  00:00:00
(22/37): httpd-2.4.54-1.amzn2.x86_64.rpm                                                                                                                                                 | 1.4 MB  00:00:00
(23/37): libfdisk-2.30.2-2.amzn2.0.9.x86_64.rpm                                                                                                                                          | 238 kB  00:00:00
(24/37): libpwquality-1.2.3-5.amzn2.x86_64.rpm                                                                                                                                           |  84 kB  00:00:00
(25/37): libsemanage-2.5-11.amzn2.x86_64.rpm                                                                                                                                             | 152 kB  00:00:00
(26/37): libutempter-1.1.6-4.amzn2.0.2.x86_64.rpm                                                                                                                                        |  25 kB  00:00:00
(27/37): libsmartcols-2.30.2-2.amzn2.0.9.x86_64.rpm                                                                                                                                      | 155 kB  00:00:00
(28/37): mailcap-2.1.41-2.amzn2.noarch.rpm                                                                                                                                               |  31 kB  00:00:00
(29/37): lz4-1.7.5-2.amzn2.0.1.x86_64.rpm                                                                                                                                                |  99 kB  00:00:00
(30/37): mod_http2-1.15.19-1.amzn2.0.1.x86_64.rpm                                                                                                                                        | 149 kB  00:00:00
(31/37): qrencode-libs-3.4.1-3.amzn2.0.2.x86_64.rpm                                                                                                                                      |  50 kB  00:00:00
(32/37): pam-1.1.8-23.amzn2.0.1.x86_64.rpm                                                                                                                                               | 715 kB  00:00:00
(33/37): shadow-utils-4.1.5.1-24.amzn2.0.2.x86_64.rpm                                                                                                                                    | 1.1 MB  00:00:00
(34/37): systemd-libs-219-78.amzn2.0.20.x86_64.rpm                                                                                                                                       | 409 kB  00:00:00
(35/37): ustr-1.0.4-16.amzn2.0.3.x86_64.rpm                                                                                                                                              |  96 kB  00:00:00
(36/37): systemd-219-78.amzn2.0.20.x86_64.rpm                                                                                                                                            | 5.0 MB  00:00:01
(37/37): util-linux-2.30.2-2.amzn2.0.9.x86_64.rpm                                                                                                                                        | 2.3 MB  00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                           4.0 MB/s |  18 MB  00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.7.0-9.amzn2.x86_64                                                                                                                                                                    1/37
  Installing : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64                                                                                                                                                       2/37
  Installing : apr-util-1.6.1-5.amzn2.0.2.x86_64                                                                                                                                                           3/37
  Installing : libcap-ng-0.7.5-4.amzn2.0.4.x86_64                                                                                                                                                          4/37
  Installing : audit-libs-2.8.1-3.amzn2.1.x86_64                                                                                                                                                           5/37
  Installing : lz4-1.7.5-2.amzn2.0.1.x86_64                                                                                                                                                                6/37
  Installing : httpd-tools-2.4.54-1.amzn2.x86_64                                                                                                                                                           7/37
  Installing : kmod-libs-25-3.amzn2.0.2.x86_64                                                                                                                                                             8/37
  Installing : libsmartcols-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                      9/37
  Installing : acl-2.2.51-14.amzn2.x86_64                                                                                                                                                                 10/37
  Installing : kmod-25-3.amzn2.0.2.x86_64                                                                                                                                                                 11/37
  Installing : ustr-1.0.4-16.amzn2.0.3.x86_64                                                                                                                                                             12/37
  Installing : libsemanage-2.5-11.amzn2.x86_64                                                                                                                                                            13/37
  Installing : 2:shadow-utils-4.1.5.1-24.amzn2.0.2.x86_64                                                                                                                                                 14/37
  Installing : libutempter-1.1.6-4.amzn2.0.2.x86_64                                                                                                                                                       15/37
  Installing : httpd-filesystem-2.4.54-1.amzn2.noarch                                                                                                                                                     16/37
  Installing : qrencode-libs-3.4.1-3.amzn2.0.2.x86_64                                                                                                                                                     17/37
  Installing : libfdisk-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                         18/37
  Installing : generic-logos-httpd-18.0.0-4.amzn2.noarch                                                                                                                                                  19/37
  Installing : mailcap-2.1.41-2.amzn2.noarch                                                                                                                                                              20/37
  Installing : gzip-1.5-10.amzn2.0.1.x86_64                                                                                                                                                               21/37
  Installing : cracklib-2.9.0-11.amzn2.0.2.x86_64                                                                                                                                                         22/37
  Installing : cracklib-dicts-2.9.0-11.amzn2.0.2.x86_64                                                                                                                                                   23/37
  Installing : pam-1.1.8-23.amzn2.0.1.x86_64                                                                                                                                                              24/37
  Installing : libpwquality-1.2.3-5.amzn2.x86_64                                                                                                                                                          25/37
  Installing : util-linux-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                       26/37
  Installing : 7:device-mapper-1.02.170-6.amzn2.5.x86_64                                                                                                                                                  27/37
  Installing : 7:device-mapper-libs-1.02.170-6.amzn2.5.x86_64                                                                                                                                             28/37
  Installing : cryptsetup-libs-1.7.4-4.amzn2.x86_64                                                                                                                                                       29/37
  Installing : elfutils-libs-0.176-2.amzn2.x86_64                                                                                                                                                         30/37
  Installing : systemd-libs-219-78.amzn2.0.20.x86_64                                                                                                                                                      31/37
  Installing : 1:dbus-libs-1.10.24-7.amzn2.0.2.x86_64                                                                                                                                                     32/37
  Installing : systemd-219-78.amzn2.0.20.x86_64                                                                                                                                                           33/37
Failed to get D-Bus connection: Operation not permitted
  Installing : elfutils-default-yama-scope-0.176-2.amzn2.noarch                                                                                                                                           34/37
  Installing : 1:dbus-1.10.24-7.amzn2.0.2.x86_64                                                                                                                                                          35/37
  Installing : mod_http2-1.15.19-1.amzn2.0.1.x86_64                                                                                                                                                       36/37
  Installing : httpd-2.4.54-1.amzn2.x86_64                                                                                                                                                                37/37
  Verifying  : cracklib-2.9.0-11.amzn2.0.2.x86_64                                                                                                                                                          1/37
  Verifying  : systemd-libs-219-78.amzn2.0.20.x86_64                                                                                                                                                       2/37
  Verifying  : gzip-1.5-10.amzn2.0.1.x86_64                                                                                                                                                                3/37
  Verifying  : elfutils-default-yama-scope-0.176-2.amzn2.noarch                                                                                                                                            4/37
  Verifying  : systemd-219-78.amzn2.0.20.x86_64                                                                                                                                                            5/37
  Verifying  : pam-1.1.8-23.amzn2.0.1.x86_64                                                                                                                                                               6/37
  Verifying  : mailcap-2.1.41-2.amzn2.noarch                                                                                                                                                               7/37
  Verifying  : generic-logos-httpd-18.0.0-4.amzn2.noarch                                                                                                                                                   8/37
  Verifying  : apr-util-1.6.1-5.amzn2.0.2.x86_64                                                                                                                                                           9/37
  Verifying  : 7:device-mapper-1.02.170-6.amzn2.5.x86_64                                                                                                                                                  10/37
  Verifying  : libfdisk-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                         11/37
  Verifying  : libutempter-1.1.6-4.amzn2.0.2.x86_64                                                                                                                                                       12/37
  Verifying  : lz4-1.7.5-2.amzn2.0.1.x86_64                                                                                                                                                               13/37
  Verifying  : qrencode-libs-3.4.1-3.amzn2.0.2.x86_64                                                                                                                                                     14/37
  Verifying  : httpd-2.4.54-1.amzn2.x86_64                                                                                                                                                                15/37
  Verifying  : libpwquality-1.2.3-5.amzn2.x86_64                                                                                                                                                          16/37
  Verifying  : 7:device-mapper-libs-1.02.170-6.amzn2.5.x86_64                                                                                                                                             17/37
  Verifying  : cracklib-dicts-2.9.0-11.amzn2.0.2.x86_64                                                                                                                                                   18/37
  Verifying  : cryptsetup-libs-1.7.4-4.amzn2.x86_64                                                                                                                                                       19/37
  Verifying  : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64                                                                                                                                                      20/37
  Verifying  : libcap-ng-0.7.5-4.amzn2.0.4.x86_64                                                                                                                                                         21/37
  Verifying  : audit-libs-2.8.1-3.amzn2.1.x86_64                                                                                                                                                          22/37
  Verifying  : ustr-1.0.4-16.amzn2.0.3.x86_64                                                                                                                                                             23/37
  Verifying  : httpd-filesystem-2.4.54-1.amzn2.noarch                                                                                                                                                     24/37
  Verifying  : kmod-25-3.amzn2.0.2.x86_64                                                                                                                                                                 25/37
  Verifying  : acl-2.2.51-14.amzn2.x86_64                                                                                                                                                                 26/37
  Verifying  : libsemanage-2.5-11.amzn2.x86_64                                                                                                                                                            27/37
  Verifying  : apr-1.7.0-9.amzn2.x86_64                                                                                                                                                                   28/37
  Verifying  : elfutils-libs-0.176-2.amzn2.x86_64                                                                                                                                                         29/37
  Verifying  : 1:dbus-1.10.24-7.amzn2.0.2.x86_64                                                                                                                                                          30/37
  Verifying  : 2:shadow-utils-4.1.5.1-24.amzn2.0.2.x86_64                                                                                                                                                 31/37
  Verifying  : libsmartcols-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                     32/37
  Verifying  : 1:dbus-libs-1.10.24-7.amzn2.0.2.x86_64                                                                                                                                                     33/37
  Verifying  : kmod-libs-25-3.amzn2.0.2.x86_64                                                                                                                                                            34/37
  Verifying  : httpd-tools-2.4.54-1.amzn2.x86_64                                                                                                                                                          35/37
  Verifying  : mod_http2-1.15.19-1.amzn2.0.1.x86_64                                                                                                                                                       36/37
  Verifying  : util-linux-2.30.2-2.amzn2.0.9.x86_64                                                                                                                                                       37/37

Installed:
  httpd.x86_64 0:2.4.54-1.amzn2

Dependency Installed:
  acl.x86_64 0:2.2.51-14.amzn2                             apr.x86_64 0:1.7.0-9.amzn2                    apr-util.x86_64 0:1.6.1-5.amzn2.0.2               apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2
  audit-libs.x86_64 0:2.8.1-3.amzn2.1                      cracklib.x86_64 0:2.9.0-11.amzn2.0.2          cracklib-dicts.x86_64 0:2.9.0-11.amzn2.0.2        cryptsetup-libs.x86_64 0:1.7.4-4.amzn2
  dbus.x86_64 1:1.10.24-7.amzn2.0.2                        dbus-libs.x86_64 1:1.10.24-7.amzn2.0.2        device-mapper.x86_64 7:1.02.170-6.amzn2.5         device-mapper-libs.x86_64 7:1.02.170-6.amzn2.5
  elfutils-default-yama-scope.noarch 0:0.176-2.amzn2       elfutils-libs.x86_64 0:0.176-2.amzn2          generic-logos-httpd.noarch 0:18.0.0-4.amzn2       gzip.x86_64 0:1.5-10.amzn2.0.1
  httpd-filesystem.noarch 0:2.4.54-1.amzn2                 httpd-tools.x86_64 0:2.4.54-1.amzn2           kmod.x86_64 0:25-3.amzn2.0.2                      kmod-libs.x86_64 0:25-3.amzn2.0.2
  libcap-ng.x86_64 0:0.7.5-4.amzn2.0.4                     libfdisk.x86_64 0:2.30.2-2.amzn2.0.9          libpwquality.x86_64 0:1.2.3-5.amzn2               libsemanage.x86_64 0:2.5-11.amzn2
  libsmartcols.x86_64 0:2.30.2-2.amzn2.0.9                 libutempter.x86_64 0:1.1.6-4.amzn2.0.2        lz4.x86_64 0:1.7.5-2.amzn2.0.1                    mailcap.noarch 0:2.1.41-2.amzn2
  mod_http2.x86_64 0:1.15.19-1.amzn2.0.1                   pam.x86_64 0:1.1.8-23.amzn2.0.1               qrencode-libs.x86_64 0:3.4.1-3.amzn2.0.2          shadow-utils.x86_64 2:4.1.5.1-24.amzn2.0.2
  systemd.x86_64 0:219-78.amzn2.0.20                       systemd-libs.x86_64 0:219-78.amzn2.0.20       ustr.x86_64 0:1.0.4-16.amzn2.0.3                  util-linux.x86_64 0:2.30.2-2.amzn2.0.9

Complete!
```

</details>

インストールした Apache のバージョンを確認します。

```bash:ターミナル(Dockerコンテナ内)
httpd -v
```

- 実行時ログ
    
    ```bash
    bash-4.2# httpd -v
    Server version: Apache/2.4.54 ()
    Server built:   Jun 30 2022 11:02:23
    ```
    

## 4-3. Apache の起動

Apache を起動するコマンドを実行します。

```bash:ターミナル(Dockerコンテナ内)
apachectl -D FOREGROUND
```

- 実行時ログ
    
    ```bash
    bash-4.2# apachectl -D FOREGROUND
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
    ```
    

Apache 起動の確認のため、ブラウザで http://localhost:8080/ にアクセスします。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/527226/e21512d8-9876-6e38-73ff-71da8f777a76.png)

Apache のテストページが表示されました。（Apacheが起動している）

# 5. Docker イメージとコンテナの再作成

ここまで実行したコマンドを Dockerfile に記述して、 Docker イメージとコンテナを再作成します。

## 5-1. Dockerfile の編集

ここまで実行したコマンドを **Dockerfile** に記述します。

```docker:Dockerfile
FROM amazonlinux:2

RUN yum update -y \
  && yum install -y httpd

CMD [ "apachectl", "-D", "FOREGROUND" ]
```

## 5-2. Docker イメージとコンテナの再作成

Docker コンテナを削除し、 Docker イメージを作り直して、 Docker コンテナを作成・起動します。

```bash:ターミナル
docker container rm -f advent-calendar
docker image build -t advent-calendar/advent-calendar:latest . 
docker container run -d --name advent-calendar -p 8080:80 advent-calendar/advent-calendar:latest
```

- 実行時ログ
    
    ```bash
    bash-4.2# exit
    exit
    
    # r_yamate @ mbp in ~/Documents/code/advent-calendar [6:18:15] C:143
    $ docker container ls
    CONTAINER ID   IMAGE                                    COMMAND       CREATED        STATUS        PORTS                  NAMES
    0b8dd9cc00c9   advent-calendar/advent-calendar:latest   "/bin/bash"   23 hours ago   Up 23 hours   0.0.0.0:8080->80/tcp   advent-calendar
    
    # r_yamate @ mbp in ~/Documents/code/advent-calendar [6:18:29]
    $ docker container rm -f advent-calendar
    advent-calendar
    
    # r_yamate @ mbp in ~/Documents/code/advent-calendar [6:18:55]
    $ docker container ls
    CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
    
    # r_yamate @ mbp in ~/Documents/code/advent-calendar [6:19:00]
    $ docker image build -t advent-calendar/advent-calendar:latest .
    [+] Building 45.9s (6/6) FINISHED
     => [internal] load build definition from Dockerfile                                                                                                                                                       0.1s
     => => transferring dockerfile: 149B                                                                                                                                                                       0.0s
     => [internal] load .dockerignore                                                                                                                                                                          0.0s
     => => transferring context: 2B                                                                                                                                                                            0.0s
     => [internal] load metadata for docker.io/library/amazonlinux:2                                                                                                                                           3.4s
     => CACHED [1/2] FROM docker.io/library/amazonlinux:2@sha256:f0ad031d65bf6cd219d8621d2a304d884c6a809ca2b20855eac371df92f4fcaf                                                                              0.0s
     => [2/2] RUN yum update -y   && yum install -y httpd                                                                                                                                                     39.0s
     => exporting to image                                                                                                                                                                                     3.3s
     => => exporting layers                                                                                                                                                                                    3.2s
     => => writing image sha256:e29ec550635cf4e60303e02831350dd5c584226ef598276f21fa3d55255247bd                                                                                                               0.0s
     => => naming to docker.io/advent-calendar/advent-calendar:latest
    
    # r_yamate @ mbp in ~/Documents/code/advent-calendar [6:20:56]
    $ docker container run -it -d --name advent-calendar -p 8080:80 advent-calendar/advent-calendar:latest
    483dd4a0e44fc685c29ff26e1185d6f6548cf8548f626826daafd6050aeac27a
    ```
    

## 5-3. Apache 起動のブラウザでの確認

localhost:8080にアクセスすると、Apacheが起動しています。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/527226/67a82495-c5d0-6a38-d0c7-41332c68622f.png)

# おわりに

今回は、 **② Apache の導入** についての手順でした。

次回は、 **[③ PHP 8.1 系のインストール](https://qiita.com/ryamate/items/7a38eb11d64d504a7a22)** の手順です。

ありがとうございました。

## 参考にしたサイト

https://www.acrovision.jp/service/aws/?p=653

https://qiita.com/kyosuke5_20/items/b04813bb7ca26285d95e

https://qiita.com/reflet/items/11ad79e01e808876caa1