皆さん、こんにちは! EC-CUBERの木下です。

今回は、Amazon Linux2にEC-CUBE4.0.4をインストールしていきたいと思います!

筆者はインフラ初心者です。
AWSはSAAの資格を持っていますが、コンソールは殆ど触ったことがありませんでした。

そんな中、AWSの基本構成に最新のEC-CUBEをインストールして、ダミーデータも作成できるようにせよとの任が課せられました。

四苦八苦したものの何とかテスト用の環境を作ることが出来たので、その手順を記載します。

要件

  • Amazon Linux 2
  • RDS(MySQL)
  • PHP7.2(公式ドキュメント上でEC-CUBE4.0動作確認済のものがver.7.2.19までのため)
  • EC-CUBE4.0.4(2020/08/07時点最新)

ゴール

Amazon Linux2にEC-CUBE4.0.4をインストールし、デフォルト状態でブラウザからアクセスできる。 また、ダミーデータを作るコマンドも実行できる。

使用ツール

PuTTY(SSHクライアントソフトであれば何でも)

手順

インスタンス+RDS構築までの流れは、下記を参考にさせていただきました。
今回はテスト用に環境を作成したので、Elastic IPはなしで行っています。

【AWS初心者向け】AWSでWebサーバーとデータベースを構築して、ブラウザにデータを表示する【ハンズオン】

以下の手順には、一部上記参考サイトと重なっている箇所もあります。
ご了承ください。

EC-CUBEのことはEC-CUBEのプロ「EC-CUBER」にご相談ください!
https://ec-cuber.jp/contact-us/

インスタンスにSSHアクセス+初期設定

  1. 実行中のインスタンス一覧から作成したインスタンスの説明を確認し、IPv4パブリックIPを控えておく
  2.  控えておいたIPアドレスにSSHクライアントソフト(筆者の場合はPuTTY)でSSHアクセス

ユーザー名は【ec2-user】、認証は鍵ファイルを使用
※下記はPuTTYの例ですが、初回アクセス時は必ずダイアログが表示されます。成りすましでないかどうかを確認するものなので、ホスト鍵に問題なければ【はい】をクリックしてください。

3.  コマンドを実行

rootユーザー切替
[ec2-user@ip-x-x-x-x ~]$ sudo su -
[root@ip-x-x-x-x ~]#

タイムゾーンをJSTに変更
[root@ip-x-x-x-x ~]# timedatectl set-timezone Asia/Tokyo
[root@ip-x-x-x-x ~]#

 文字コードを日本語対応に変更
[root@ip-x-x-x-x ~]# sed -i "s/en_US\.UTF-8/ja_JP\.UTF-8/g" /etc/sysconfig/i18n
[root@ip-x-x-x-x ~]#

パッケージ管理ツールyumのアップデート
[root@ip-X-X-X-X ~]# yum update -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package amazon-linux-extras.noarch 0:1.6.11-1.amzn2 will be updated
---> Package amazon-linux-extras.noarch 0:1.6.12-1.amzn2 will be an update
---> Package amazon-linux-extras-yum-plugin.noarch 0:1.6.11-1.amzn2 will be upda                                  ted
---> Package amazon-linux-extras-yum-plugin.noarch 0:1.6.12-1.amzn2 will be an u                                  pdate
---> Package ca-certificates.noarch 0:2019.2.32-76.amzn2.0.2 will be updated
---> Package ca-certificates.noarch 0:2019.2.32-76.amzn2.0.3 will be an update
---> Package python.x86_64 0:2.7.18-1.amzn2 will be updated
---> Package python.x86_64 0:2.7.18-1.amzn2.0.1 will be an update
---> Package python-devel.x86_64 0:2.7.18-1.amzn2 will be updated
---> Package python-devel.x86_64 0:2.7.18-1.amzn2.0.1 will be an update
---> Package python-libs.x86_64 0:2.7.18-1.amzn2 will be updated
---> Package python-libs.x86_64 0:2.7.18-1.amzn2.0.1 will be an update
---> Package python2-rsa.noarch 0:3.4.1-1.amzn2 will be updated
---> Package python2-rsa.noarch 0:3.4.1-1.amzn2.0.1 will be an update
---> Package tzdata.noarch 0:2019c-1.amzn2 will be updated
---> Package tzdata.noarch 0:2020a-1.amzn2 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                        Arch   Version                 Repository  Size
================================================================================
Updating:
 amazon-linux-extras            noarch 1.6.12-1.amzn2          amzn2-core  36 k
 amazon-linux-extras-yum-plugin noarch 1.6.12-1.amzn2          amzn2-core  10 k
 ca-certificates                noarch 2019.2.32-76.amzn2.0.3  amzn2-core 391 k
 python                         x86_64 2.7.18-1.amzn2.0.1      amzn2-core  92 k
 python-devel                   x86_64 2.7.18-1.amzn2.0.1      amzn2-core 403 k
 python-libs                    x86_64 2.7.18-1.amzn2.0.1      amzn2-core 7.5 M
 python2-rsa                    noarch 3.4.1-1.amzn2.0.1       amzn2-core  68 k
 tzdata                         noarch 2020a-1.amzn2           amzn2-core 479 k

Transaction Summary
================================================================================
Upgrade  8 Packages

Total download size: 9.0 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/8): amazon-linux-extras-yum-plugin-1.6.12-1.amzn2.noarc |  10 kB   00:00
(2/8): amazon-linux-extras-1.6.12-1.amzn2.noarch.rpm       |  36 kB   00:00
(3/8): python-2.7.18-1.amzn2.0.1.x86_64.rpm                |  92 kB   00:00
(4/8): ca-certificates-2019.2.32-76.amzn2.0.3.noarch.rpm   | 391 kB   00:00
(5/8): python-devel-2.7.18-1.amzn2.0.1.x86_64.rpm          | 403 kB   00:00
(6/8): python2-rsa-3.4.1-1.amzn2.0.1.noarch.rpm            |  68 kB   00:00
(7/8): tzdata-2020a-1.amzn2.noarch.rpm                     | 479 kB   00:00
(8/8): python-libs-2.7.18-1.amzn2.0.1.x86_64.rpm           | 7.5 MB   00:00
--------------------------------------------------------------------------------
Total                                               28 MB/s | 9.0 MB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : python-libs-2.7.18-1.amzn2.0.1.x86_64                            1/16
  Updating   : python-2.7.18-1.amzn2.0.1.x86_64                                   2/16
  Updating   : amazon-linux-extras-1.6.12-1.amzn2.noarch                    3/16
  Updating   : amazon-linux-extras-yum-plugin-1.6.12-1.amzn2.noarch 4/16
  Updating   : python-devel-2.7.18-1.amzn2.0.1.x86_64                         5/16
  Updating   : python2-rsa-3.4.1-1.amzn2.0.1.noarch                             6/16
  Updating   : ca-certificates-2019.2.32-76.amzn2.0.3.noarch                7/16
  Updating   : tzdata-2020a-1.amzn2.noarch                                           8/16
  Cleanup    : python-devel-2.7.18-1.amzn2.x86_64                               9/16
  Cleanup    : amazon-linux-extras-yum-plugin-1.6.11-1.amzn2.noarch  10/16
  Cleanup    : amazon-linux-extras-1.6.11-1.amzn2.noarch                     11/16
  Cleanup    : python2-rsa-3.4.1-1.amzn2.noarch                                    12/16
  Cleanup    : ca-certificates-2019.2.32-76.amzn2.0.2.noarch                13/16
  Cleanup    : tzdata-2019c-1.amzn2.noarch                                           14/16
  Cleanup    : python-2.7.18-1.amzn2.x86_64                                         15/16
  Cleanup    : python-libs-2.7.18-1.amzn2.x86_64                                  16/16
  Verifying  : python-devel-2.7.18-1.amzn2.0.1.x86_64                          1/16
  Verifying  : python-2.7.18-1.amzn2.0.1.x86_64                                    2/16
  Verifying  : tzdata-2020a-1.amzn2.noarch                                            3/16
  Verifying  : python2-rsa-3.4.1-1.amzn2.0.1.noarch                               4/16
  Verifying  : python-libs-2.7.18-1.amzn2.0.1.x86_64                              5/16
  Verifying  : amazon-linux-extras-1.6.12-1.amzn2.noarch                      6/16
  Verifying  : amazon-linux-extras-yum-plugin-1.6.12-1.amzn2.noarch   7/16
  Verifying  : ca-certificates-2019.2.32-76.amzn2.0.3.noarch                  8/16
  Verifying  : amazon-linux-extras-1.6.11-1.amzn2.noarch                      9/16
  Verifying  : python-2.7.18-1.amzn2.x86_64                                           10/16
  Verifying  : python2-rsa-3.4.1-1.amzn2.noarch                                      11/16
  Verifying  : python-devel-2.7.18-1.amzn2.x86_64                                  12/16
  Verifying  : python-libs-2.7.18-1.amzn2.x86_64                                     13/16
  Verifying  : ca-certificates-2019.2.32-76.amzn2.0.2.noarch                   14/16
  Verifying  : amazon-linux-extras-yum-plugin-1.6.11-1.amzn2.noarch    15/16
  Verifying  : tzdata-2019c-1.amzn2.noarch                                             16/16

Updated:
  amazon-linux-extras.noarch 0:1.6.12-1.amzn2          amazon-linux-extras-yum-plugin.noarch 0:1.6.12-1.amzn2
  ca-certificates.noarch 0:2019.2.32-76.amzn2.0.3      python.x86_64 0:2.7.18-1.amzn2.0.1
  python-devel.x86_64 0:2.7.18-1.amzn2.0.1             python-libs.x86_64 0:2.7.18-1.amzn2.0.1
  python2-rsa.noarch 0:3.4.1-1.amzn2.0.1               tzdata.noarch 0:2020a-1.amzn2

Complete!
[root@ip-X-X-X-X ~]#

RDS疎通確認+空DB作成

  1. rootユーザーのままコマンドを実行
MySQLクライアントのインストール
[root@ip-X-X-X-X ~]# yum install -y mysql
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                 | 3.7 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.64-1.amzn2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                 Arch                   Version                          Repository                  Size
==================================================================================================================
Installing:
 mariadb                 x86_64                 1:5.5.64-1.amzn2                 amzn2-core                 9.0 M

Transaction Summary
==================================================================================================================
Install  1 Package

Total download size: 9.0 M
Installed size: 49 M
Downloading packages:
mariadb-5.5.64-1.amzn2.x86_64.rpm                                                          | 9.0 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:mariadb-5.5.64-1.amzn2.x86_64                                                                1/1
  Verifying  : 1:mariadb-5.5.64-1.amzn2.x86_64                                                                1/1

Installed:
  mariadb.x86_64 1:5.5.64-1.amzn2

Complete!
[root@ip-X-X-X-X ~]#

MySQLにログイン
[ec2-user@ip-X-X-X-X ~]$ mysql -h RDSエンドポイント -P 3306 -u ユーザー名 -p
Enter password:   # パスワード入力を求められるため入力
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.5.61-log Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

ログインに成功したら、空のDBを作成
MySQL [(none)]> create database DB名;
Query OK, 1 row affected (0.01 sec)

 ログアウト
MySQL [(none)]> exit;
Bye
[ec2-user@ip-X-X-X-X ~]$ 


Apache インストール+自動起動設定

  1. rootユーザーのままコマンドを実行
apacheのインストール
[root@ip-X-X-X-X ~]# yum install -y httpd
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.43-1.amzn2 will be installed
--> Processing Dependency: httpd-tools = 2.4.43-1.amzn2 for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem = 2.4.43-1.amzn2 for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: system-logos-httpd for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: mod_http2 for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: httpd-filesystem for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.43-1.amzn2.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.43-1.amzn2.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.6.3-5.amzn2.0.2 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.43-1.amzn2 will be installed
---> Package httpd-tools.x86_64 0:2.4.43-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.3-2.amzn2 will be installed
--> Running transaction check
---> Package apr-util-bdb.x86_64 0:1.6.1-5.amzn2.0.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                         Arch               Version                          Repository              Size
==================================================================================================================
Installing:
 httpd                           x86_64             2.4.43-1.amzn2                   amzn2-core             1.3 M
Installing for dependencies:
 apr                             x86_64             1.6.3-5.amzn2.0.2                amzn2-core             118 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
 generic-logos-httpd             noarch             18.0.0-4.amzn2                   amzn2-core              19 k
 httpd-filesystem                noarch             2.4.43-1.amzn2                   amzn2-core              23 k
 httpd-tools                     x86_64             2.4.43-1.amzn2                   amzn2-core              87 k
 mailcap                         noarch             2.1.41-2.amzn2                   amzn2-core              31 k
 mod_http2                       x86_64             1.15.3-2.amzn2                   amzn2-core             146 k

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

Total download size: 1.8 M
Installed size: 5.1 M
Downloading packages:
(1/9): apr-util-1.6.1-5.amzn2.0.2.x86_64.rpm                                               |  99 kB  00:00:00
(2/9): apr-1.6.3-5.amzn2.0.2.x86_64.rpm                                                    | 118 kB  00:00:00
(3/9): apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64.rpm                                           |  19 kB  00:00:00
(4/9): generic-logos-httpd-18.0.0-4.amzn2.noarch.rpm                                       |  19 kB  00:00:00
(5/9): httpd-filesystem-2.4.43-1.amzn2.noarch.rpm                                          |  23 kB  00:00:00
(6/9): httpd-2.4.43-1.amzn2.x86_64.rpm                                                     | 1.3 MB  00:00:00
(7/9): httpd-tools-2.4.43-1.amzn2.x86_64.rpm                                               |  87 kB  00:00:00
(8/9): mailcap-2.1.41-2.amzn2.noarch.rpm                                                   |  31 kB  00:00:00
(9/9): mod_http2-1.15.3-2.amzn2.x86_64.rpm                                                 | 146 kB  00:00:00
------------------------------------------------------------------------------------------------------------------
Total                                                                             8.0 MB/s | 1.8 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.6.3-5.amzn2.0.2.x86_64                                                                   1/9
  Installing : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64                                                          2/9
  Installing : apr-util-1.6.1-5.amzn2.0.2.x86_64                                                              3/9
  Installing : httpd-tools-2.4.43-1.amzn2.x86_64                                                              4/9
  Installing : generic-logos-httpd-18.0.0-4.amzn2.noarch                                                      5/9
  Installing : mailcap-2.1.41-2.amzn2.noarch                                                                  6/9
  Installing : httpd-filesystem-2.4.43-1.amzn2.noarch                                                         7/9
  Installing : mod_http2-1.15.3-2.amzn2.x86_64                                                                8/9
  Installing : httpd-2.4.43-1.amzn2.x86_64                                                                    9/9
  Verifying  : apr-util-1.6.1-5.amzn2.0.2.x86_64                                                              1/9
  Verifying  : apr-util-bdb-1.6.1-5.amzn2.0.2.x86_64                                                          2/9
  Verifying  : httpd-2.4.43-1.amzn2.x86_64                                                                    3/9
  Verifying  : mod_http2-1.15.3-2.amzn2.x86_64                                                                4/9
  Verifying  : httpd-filesystem-2.4.43-1.amzn2.noarch                                                         5/9
  Verifying  : apr-1.6.3-5.amzn2.0.2.x86_64                                                                   6/9
  Verifying  : mailcap-2.1.41-2.amzn2.noarch                                                                  7/9
  Verifying  : generic-logos-httpd-18.0.0-4.amzn2.noarch                                                      8/9
  Verifying  : httpd-tools-2.4.43-1.amzn2.x86_64                                                              9/9

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

Dependency Installed:
  apr.x86_64 0:1.6.3-5.amzn2.0.2                         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                generic-logos-httpd.noarch 0:18.0.0-4.amzn2
  httpd-filesystem.noarch 0:2.4.43-1.amzn2               httpd-tools.x86_64 0:2.4.43-1.amzn2
  mailcap.noarch 0:2.1.41-2.amzn2                        mod_http2.x86_64 0:1.15.3-2.amzn2

Complete!
[root@ip-X-X-X-X ~]#

apache設定ファイルを開く

viエディタの使い方はこちらをご参考にしてみてください!
[ viエディタの使い方 ](https://prev.net-newbie.com/linux/commands/vi.html)

[root@ip-X-X-X-X ~]# vi /etc/httpd/conf/httpd.conf
PHPファイルを認識させるため、<IfModule mime_module>~</IfModule> 内に以下の記述を追加
<IfModule mime_module>
    ### 省略 ###

    AddType application/x-httpd-php .php    #←追加
</IfModule>

EC-CUBEの.htaccessを有効にするため、<Directory “/var/www/html”>~</Directory> 内の「AllowOverride None」を、下記のように書き換える
<Directory "/var/www/html">
    ### 省略 ###

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    # AllowOverride None    #←コメントアウト
    AllowOverride All    #←追加

    ### 省略 ###
</Directory>

# apache設定ファイルを閉じる

apacheが自動で起動するよう設定する
[root@ip-X-X-X-X ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@ip-X-X-X-X ~]#

PHP+ミドルウェアのインストール

  1. rootユーザーのままコマンドを実行
PHP7.2のインストール(EC-CUBEに必須のライブラリもある程度追加される)
[root@ip-X-X-X-X ~]# amazon-linux-extras install -y php7.2
Installing php-pdo, php-fpm, php-mysqlnd, php-cli, php-json
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cleaning repos: amzn2-core amzn2extra-docker amzn2extra-php7.2
12 metadata files removed
4 sqlite files removed
0 metadata files removed
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                 | 3.7 kB  00:00:00
amzn2extra-docker                                                                          | 3.0 kB  00:00:00
amzn2extra-php7.2                                                                          | 3.0 kB  00:00:00
(1/7): amzn2-core/2/x86_64/group_gz                                                        | 2.5 kB  00:00:00
(2/7): amzn2-core/2/x86_64/updateinfo                                                      | 245 kB  00:00:00
(3/7): amzn2extra-php7.2/2/x86_64/primary_db                                               | 544 kB  00:00:00
(4/7): amzn2extra-docker/2/x86_64/updateinfo                                               |   69 B  00:00:00
(5/7): amzn2extra-php7.2/2/x86_64/updateinfo                                               |   69 B  00:00:00
(6/7): amzn2extra-docker/2/x86_64/primary_db                                               |  68 kB  00:00:00
(7/7): amzn2-core/2/x86_64/primary_db                                                      |  43 MB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package php-cli.x86_64 0:7.2.31-1.amzn2 will be installed
--> Processing Dependency: php-common(x86-64) = 7.2.31-1.amzn2 for package: php-cli-7.2.31-1.amzn2.x86_64
---> Package php-fpm.x86_64 0:7.2.31-1.amzn2 will be installed
---> Package php-json.x86_64 0:7.2.31-1.amzn2 will be installed
---> Package php-mysqlnd.x86_64 0:7.2.31-1.amzn2 will be installed
---> Package php-pdo.x86_64 0:7.2.31-1.amzn2 will be installed
--> Running transaction check
---> Package php-common.x86_64 0:7.2.31-1.amzn2 will be installed
--> Processing Dependency: libzip.so.5()(64bit) for package: php-common-7.2.31-1.amzn2.x86_64
--> Running transaction check
---> Package libzip.x86_64 0:1.3.2-1.amzn2.0.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                  Arch                Version                        Repository                      Size
==================================================================================================================
Installing:
 php-cli                  x86_64              7.2.31-1.amzn2                 amzn2extra-php7.2              4.4 M
 php-fpm                  x86_64              7.2.31-1.amzn2                 amzn2extra-php7.2              1.5 M
 php-json                 x86_64              7.2.31-1.amzn2                 amzn2extra-php7.2               71 k
 php-mysqlnd              x86_64              7.2.31-1.amzn2                 amzn2extra-php7.2              238 k
 php-pdo                  x86_64              7.2.31-1.amzn2                 amzn2extra-php7.2              132 k
Installing for dependencies:
 libzip                   x86_64              1.3.2-1.amzn2.0.1              amzn2-core                      62 k
 php-common               x86_64              7.2.31-1.amzn2                 amzn2extra-php7.2              1.1 M

Transaction Summary
==================================================================================================================
Install  5 Packages (+2 Dependent packages)

Total download size: 7.5 M
Installed size: 31 M
Downloading packages:
(1/7): libzip-1.3.2-1.amzn2.0.1.x86_64.rpm                                                 |  62 kB  00:00:00
(2/7): php-cli-7.2.31-1.amzn2.x86_64.rpm                                                   | 4.4 MB  00:00:00
(3/7): php-common-7.2.31-1.amzn2.x86_64.rpm                                                | 1.1 MB  00:00:00
(4/7): php-json-7.2.31-1.amzn2.x86_64.rpm                                                  |  71 kB  00:00:00
(5/7): php-fpm-7.2.31-1.amzn2.x86_64.rpm                                                   | 1.5 MB  00:00:00
(6/7): php-mysqlnd-7.2.31-1.amzn2.x86_64.rpm                                               | 238 kB  00:00:00
(7/7): php-pdo-7.2.31-1.amzn2.x86_64.rpm                                                   | 132 kB  00:00:00
------------------------------------------------------------------------------------------------------------------
Total                                                                              13 MB/s | 7.5 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libzip-1.3.2-1.amzn2.0.1.x86_64                                                                1/7
  Installing : php-json-7.2.31-1.amzn2.x86_64                                                                 2/7
  Installing : php-common-7.2.31-1.amzn2.x86_64                                                               3/7
  Installing : php-pdo-7.2.31-1.amzn2.x86_64                                                                  4/7
  Installing : php-mysqlnd-7.2.31-1.amzn2.x86_64                                                              5/7
  Installing : php-cli-7.2.31-1.amzn2.x86_64                                                                  6/7
  Installing : php-fpm-7.2.31-1.amzn2.x86_64                                                                  7/7
  Verifying  : php-common-7.2.31-1.amzn2.x86_64                                                               1/7
  Verifying  : php-json-7.2.31-1.amzn2.x86_64                                                                 2/7
  Verifying  : php-mysqlnd-7.2.31-1.amzn2.x86_64                                                              3/7
  Verifying  : php-pdo-7.2.31-1.amzn2.x86_64                                                                  4/7
  Verifying  : php-cli-7.2.31-1.amzn2.x86_64                                                                  5/7
  Verifying  : libzip-1.3.2-1.amzn2.0.1.x86_64                                                                6/7
  Verifying  : php-fpm-7.2.31-1.amzn2.x86_64                                                                  7/7

Installed:
  php-cli.x86_64 0:7.2.31-1.amzn2         php-fpm.x86_64 0:7.2.31-1.amzn2     php-json.x86_64 0:7.2.31-1.amzn2
  php-mysqlnd.x86_64 0:7.2.31-1.amzn2     php-pdo.x86_64 0:7.2.31-1.amzn2

Dependency Installed:
  libzip.x86_64 0:1.3.2-1.amzn2.0.1                       php-common.x86_64 0:7.2.31-1.amzn2

Complete!
  0  ansible2                 available    \
        [ =2.4.2  =2.4.6  =2.8  =stable ]
  2  httpd_modules            available    [ =1.0  =stable ]
  3  memcached1.5             available    \
        [ =1.5.1  =1.5.16  =1.5.17 ]
  5  postgresql9.6            available    \
        [ =9.6.6  =9.6.8  =stable ]
  6  postgresql10             available    [ =10  =stable ]
  8  redis4.0                 available    \
        [ =4.0.5  =4.0.10  =stable ]
  9  R3.4                     available    [ =3.4.3  =stable ]
 10  rust1                    available    \
        [ =1.22.1  =1.26.0  =1.26.1  =1.27.2  =1.31.0  =1.38.0
          =stable ]
 11  vim                      available    [ =8.0  =stable ]
 13  ruby2.4                  available    \
        [ =2.4.2  =2.4.4  =2.4.7  =stable ]
 15  php7.2=latest            enabled      \
        [ =7.2.0  =7.2.4  =7.2.5  =7.2.8  =7.2.11  =7.2.13  =7.2.14
          =7.2.16  =7.2.17  =7.2.19  =7.2.21  =7.2.22  =7.2.23
          =7.2.24  =7.2.26  =stable ]
 17  lamp-mariadb10.2-php7.2  available    \
        [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5
          =10.2.10_7.2.8  =10.2.10_7.2.11  =10.2.10_7.2.13
          =10.2.10_7.2.14  =10.2.10_7.2.16  =10.2.10_7.2.17
          =10.2.10_7.2.19  =10.2.10_7.2.22  =10.2.10_7.2.23
          =10.2.10_7.2.24  =stable ]
 18  libreoffice              available    \
        [ =5.0.6.2_15  =5.3.6.1  =stable ]
 19  gimp                     available    [ =2.8.22 ]
 20  docker=latest            enabled      \
        [ =17.12.1  =18.03.1  =18.06.1  =18.09.9  =stable ]
 21  mate-desktop1.x          available    \
        [ =1.19.0  =1.20.0  =stable ]
 22  GraphicsMagick1.3        available    \
        [ =1.3.29  =1.3.32  =1.3.34  =stable ]
 23  tomcat8.5                available    \
        [ =8.5.31  =8.5.32  =8.5.38  =8.5.40  =8.5.42  =8.5.50
          =stable ]
 24  epel                     available    [ =7.11  =stable ]
 25  testing                  available    [ =1.0  =stable ]
 26  ecs                      available    [ =stable ]
 27  corretto8                available    \
        [ =1.8.0_192  =1.8.0_202  =1.8.0_212  =1.8.0_222  =1.8.0_232
          =1.8.0_242  =stable ]
 28  firecracker              available    [ =0.11  =stable ]
 29  golang1.11               available    \
        [ =1.11.3  =1.11.11  =1.11.13  =stable ]
 30  squid4                   available    [ =4  =stable ]
  _  php7.3                   available    \
        [ =7.3.2  =7.3.3  =7.3.4  =7.3.6  =7.3.8  =7.3.9  =7.3.10
          =7.3.11  =7.3.13  =stable ]
 32  lustre2.10               available    \
        [ =2.10.5  =2.10.8  =stable ]
 33  java-openjdk11           available    [ =11  =stable ]
 34  lynis                    available    [ =stable ]
 35  kernel-ng                available    [ =stable ]
 36  BCC                      available    [ =0.x  =stable ]
 37  mono                     available    [ =5.x  =stable ]
 38  nginx1                   available    [ =stable ]
 39  ruby2.6                  available    [ =2.6  =stable ]
 40  mock                     available    [ =stable ]
 41  postgresql11             available    [ =11  =stable ]
  _  php7.4                   available    [ =stable ]
 43  livepatch                available    [ =stable ]
 44  python3.8                available    [ =stable ]
 45  haproxy2                 available    [ =stable ]
[root@ip-X-X-X-X ~]#

足りないライブラリをインストール
[root@ip-X-X-X-X ~]# yum install -y php-mbstring php-xml php-intl
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package php-intl.x86_64 0:7.2.31-1.amzn2 will be installed
---> Package php-mbstring.x86_64 0:7.2.31-1.amzn2 will be installed
--> Processing Dependency: libonig.so.2()(64bit) for package: php-mbstring-7.2.31-1.amzn2.x86_64
---> Package php-xml.x86_64 0:7.2.31-1.amzn2 will be installed
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-7.2.31-1.amzn2.x86_64
--> Running transaction check
---> Package libxslt.x86_64 0:1.1.28-5.amzn2.0.2 will be installed
---> Package oniguruma.x86_64 0:5.9.6-1.amzn2.0.3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                  Arch               Version                          Repository                     Size
==================================================================================================================
Installing:
 php-intl                 x86_64             7.2.31-1.amzn2                   amzn2extra-php7.2             224 k
 php-mbstring             x86_64             7.2.31-1.amzn2                   amzn2extra-php7.2             501 k
 php-xml                  x86_64             7.2.31-1.amzn2                   amzn2extra-php7.2             212 k
Installing for dependencies:
 libxslt                  x86_64             1.1.28-5.amzn2.0.2               amzn2-core                    243 k
 oniguruma                x86_64             5.9.6-1.amzn2.0.3                amzn2-core                    127 k

Transaction Summary
==================================================================================================================
Install  3 Packages (+2 Dependent packages)

Total download size: 1.3 M
Installed size: 4.7 M
Downloading packages:
(1/5): oniguruma-5.9.6-1.amzn2.0.3.x86_64.rpm                                              | 127 kB  00:00:00
(2/5): libxslt-1.1.28-5.amzn2.0.2.x86_64.rpm                                               | 243 kB  00:00:00
(3/5): php-intl-7.2.31-1.amzn2.x86_64.rpm                                                  | 224 kB  00:00:00
(4/5): php-mbstring-7.2.31-1.amzn2.x86_64.rpm                                              | 501 kB  00:00:00
(5/5): php-xml-7.2.31-1.amzn2.x86_64.rpm                                                   | 212 kB  00:00:00
------------------------------------------------------------------------------------------------------------------
Total                                                                             3.7 MB/s | 1.3 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libxslt-1.1.28-5.amzn2.0.2.x86_64                                                              1/5
  Installing : oniguruma-5.9.6-1.amzn2.0.3.x86_64                                                             2/5
  Installing : php-mbstring-7.2.31-1.amzn2.x86_64                                                             3/5
  Installing : php-xml-7.2.31-1.amzn2.x86_64                                                                  4/5
  Installing : php-intl-7.2.31-1.amzn2.x86_64                                                                 5/5
  Verifying  : php-intl-7.2.31-1.amzn2.x86_64                                                                 1/5
  Verifying  : oniguruma-5.9.6-1.amzn2.0.3.x86_64                                                             2/5
  Verifying  : libxslt-1.1.28-5.amzn2.0.2.x86_64                                                              3/5
  Verifying  : php-mbstring-7.2.31-1.amzn2.x86_64                                                             4/5
  Verifying  : php-xml-7.2.31-1.amzn2.x86_64                                                                  5/5

Installed:
  php-intl.x86_64 0:7.2.31-1.amzn2    php-mbstring.x86_64 0:7.2.31-1.amzn2    php-xml.x86_64 0:7.2.31-1.amzn2

Dependency Installed:
  libxslt.x86_64 0:1.1.28-5.amzn2.0.2                     oniguruma.x86_64 0:5.9.6-1.amzn2.0.3

Complete!
[root@ip-X-X-X-X ~]#

ダミーデータ作成コマンドでメモリが足りなくなる場合があるため、メモリを上げておく
PHP設定ファイルを開く
[root@ip-X-X-X-X ~]# vi /etc/php.ini

メモリ制限を以下のとおり書き換える(※標準の128だとメモリ不足となるため)
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
; memory_limit = 128M   ;←コメントアウト
memory_limit = 256M   ;←追加

PHP設定ファイルを閉じる
 PHP設定ファイルの更新を反映させるため、apacheを再起動
[root@ip-X-X-X-X ~]# systemctl restart httpd.service
[root@ip-X-X-X-X ~]#

Gitを入れる

  1. rootユーザーのままコマンドを実行
[root@ip-X-X-X-X ~]# yum install -y git
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:2.23.3-1.amzn2.0.1 will be installed
--> Processing Dependency: perl-Git = 2.23.3-1.amzn2.0.1 for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: git-core-doc = 2.23.3-1.amzn2.0.1 for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: git-core = 2.23.3-1.amzn2.0.1 for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: emacs-filesystem >= 25.3 for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: perl(Git::I18N) for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: perl(Git) for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Processing Dependency: libsecret-1.so.0()(64bit) for package: git-2.23.3-1.amzn2.0.1.x86_64
--> Running transaction check
---> Package emacs-filesystem.noarch 1:25.3-3.amzn2.0.1 will be installed
---> Package git-core.x86_64 0:2.23.3-1.amzn2.0.1 will be installed
---> Package git-core-doc.noarch 0:2.23.3-1.amzn2.0.1 will be installed
---> Package libsecret.x86_64 0:0.18.5-2.amzn2.0.2 will be installed
---> Package perl-Git.noarch 0:2.23.3-1.amzn2.0.1 will be installed
--> Processing Dependency: perl(Error) for package: perl-Git-2.23.3-1.amzn2.0.1.noarch
---> Package perl-TermReadKey.x86_64 0:2.30-20.amzn2.0.2 will be installed
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.amzn2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                       Arch                Version                          Repository               Size
==================================================================================================================
Installing:
 git                           x86_64              2.23.3-1.amzn2.0.1               amzn2-core              135 k
Installing for dependencies:
 emacs-filesystem              noarch              1:25.3-3.amzn2.0.1               amzn2-core               64 k
 git-core                      x86_64              2.23.3-1.amzn2.0.1               amzn2-core              5.0 M
 git-core-doc                  noarch              2.23.3-1.amzn2.0.1               amzn2-core              2.4 M
 libsecret                     x86_64              0.18.5-2.amzn2.0.2               amzn2-core              153 k
 perl-Error                    noarch              1:0.17020-2.amzn2                amzn2-core               32 k
 perl-Git                      noarch              2.23.3-1.amzn2.0.1               amzn2-core               47 k
 perl-TermReadKey              x86_64              2.30-20.amzn2.0.2                amzn2-core               31 k

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

Total download size: 7.9 M
Installed size: 41 M
Downloading packages:
(1/8): emacs-filesystem-25.3-3.amzn2.0.1.noarch.rpm                                        |  64 kB  00:00:00
(2/8): git-2.23.3-1.amzn2.0.1.x86_64.rpm                                                   | 135 kB  00:00:00
(3/8): git-core-doc-2.23.3-1.amzn2.0.1.noarch.rpm                                          | 2.4 MB  00:00:00
(4/8): git-core-2.23.3-1.amzn2.0.1.x86_64.rpm                                              | 5.0 MB  00:00:00
(5/8): libsecret-0.18.5-2.amzn2.0.2.x86_64.rpm                                             | 153 kB  00:00:00
(6/8): perl-Error-0.17020-2.amzn2.noarch.rpm                                               |  32 kB  00:00:00
(7/8): perl-Git-2.23.3-1.amzn2.0.1.noarch.rpm                                              |  47 kB  00:00:00
(8/8): perl-TermReadKey-2.30-20.amzn2.0.2.x86_64.rpm                                       |  31 kB  00:00:00
------------------------------------------------------------------------------------------------------------------
Total                                                                              26 MB/s | 7.9 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : git-core-2.23.3-1.amzn2.0.1.x86_64                                                             1/8
  Installing : git-core-doc-2.23.3-1.amzn2.0.1.noarch                                                         2/8
  Installing : 1:perl-Error-0.17020-2.amzn2.noarch                                                            3/8
  Installing : perl-TermReadKey-2.30-20.amzn2.0.2.x86_64                                                      4/8
  Installing : libsecret-0.18.5-2.amzn2.0.2.x86_64                                                            5/8
  Installing : 1:emacs-filesystem-25.3-3.amzn2.0.1.noarch                                                     6/8
  Installing : perl-Git-2.23.3-1.amzn2.0.1.noarch                                                             7/8
  Installing : git-2.23.3-1.amzn2.0.1.x86_64                                                                  8/8
  Verifying  : 1:emacs-filesystem-25.3-3.amzn2.0.1.noarch                                                     1/8
  Verifying  : git-2.23.3-1.amzn2.0.1.x86_64                                                                  2/8
  Verifying  : libsecret-0.18.5-2.amzn2.0.2.x86_64                                                            3/8
  Verifying  : perl-TermReadKey-2.30-20.amzn2.0.2.x86_64                                                      4/8
  Verifying  : git-core-2.23.3-1.amzn2.0.1.x86_64                                                             5/8
  Verifying  : 1:perl-Error-0.17020-2.amzn2.noarch                                                            6/8
  Verifying  : perl-Git-2.23.3-1.amzn2.0.1.noarch                                                             7/8
  Verifying  : git-core-doc-2.23.3-1.amzn2.0.1.noarch                                                         8/8

Installed:
  git.x86_64 0:2.23.3-1.amzn2.0.1

Dependency Installed:
  emacs-filesystem.noarch 1:25.3-3.amzn2.0.1                 git-core.x86_64 0:2.23.3-1.amzn2.0.1
  git-core-doc.noarch 0:2.23.3-1.amzn2.0.1                   libsecret.x86_64 0:0.18.5-2.amzn2.0.2
  perl-Error.noarch 1:0.17020-2.amzn2                        perl-Git.noarch 0:2.23.3-1.amzn2.0.1
  perl-TermReadKey.x86_64 0:2.30-20.amzn2.0.2

Complete!
[root@ip-X-X-X-X ~]#

ディレクトリ・ファイル操作権限

  1. rootユーザーのままコマンドを実行
ec2-userをapacheグループに追加
[root@ip-X-X-X-X ~]# usermod -a -G apache ec2-user
[root@ip-X-X-X-X ~]#

 /var/www 以下のグループ所有権をapacheグループに変更
[root@ip-X-X-X-X ~]# chown -R ec2-user:apache /var/www
[root@ip-X-X-X-X ~]#

/var/www 以下のディレクトリに今後のグループ書き込み許可を追加する
[root@ip-X-X-X-X ~]# chmod 2775 /var/www
[root@ip-X-X-X-X ~]# find /var/www -type d -exec sudo chmod 2775 {} \;
[root@ip-X-X-X-X ~]#

/var/www 以下のファイルに今後のグループ書き込み許可を追加する
[root@ip-X-X-X-X ~]# find /var/www -type f -exec sudo chmod 0664 {} \;
[root@ip-X-X-X-X ~]#

composerインストール

ec2-userに戻ってコマンドを実行
[root@ip-X-X-X-X ~]# exit
logout
[ec2-user@ip-X-X-X-X ~]$
composerインストール
最新のインストールコマンドは、公式サイトをご覧ください。
[Download Composer](https://getcomposer.org/download/)
[ec2-user@ip-X-X-X-X ~]$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
[ec2-user@ip-X-X-X-X ~]$ php -r "if (hash_file('sha384', 'composer-setup.php') === 'e5325b19b381bfd88ce90a5ddb7823406b2a38cff6bb704b0acc289a09c8128d4a8ce2bbafcd1fcbdc38666422fe2806') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
[ec2-user@ip-X-X-X-X ~]$ php composer-setup.php
All settings correct for using Composer
Downloading...

Composer (version 1.10.10) successfully installed to: /home/ec2-user/composer.phar
Use it: php composer.phar

[ec2-user@ip-X-X-X-X ~]$ php -r "unlink('composer-setup.php');"
[ec2-user@ip-X-X-X-X ~]$

composerにパスを通す
[ec2-user@ip-X-X-X-X ~]$ sudo mv composer.phar /usr/local/bin/composer
[ec2-user@ip-X-X-X-X ~]$

※パスを通した後、composer -v を行い、バージョンが表示されれば、composer をコマンドとして認識されております。
エラーが表示され、使用できない場合は、下記サイトを参考にしてください。

[composer: command not found と Could not open input file :/usr/local/bin/composer.phar からの対処]
(https://qiita.com/masa_stone22/items/bb56170f540391ba554d)

EC-CUBEインストール

  1. ec2-userのままコマンドを実行
ドキュメントルート配下に移動する
[ec2-user@ip-X-X-X-X ~]$ cd /var/www/html/
[ec2-user@ip-X-X-X-X html]$ 

ダミーデータ作成コマンド実行のためには 公式のgitリポジトリからクローンする必要がある
[ec2-user@ip-X-X-X-X html]$ git clone https://github.com/EC-CUBE/ec-cube.git
Cloning into 'ec-cube'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 275300 (delta 12), reused 9 (delta 2), pack-reused 275262
Receiving objects: 100% (275300/275300), 130.59 MiB | 13.77 MiB/s, done.
Resolving deltas: 100% (196112/196112), done.
[ec2-user@ip-X-X-X-X html]$

bin/consoleに実行権限を付与する
※ EC-CUBEのコマンドを利用する場合は bin/console に実行権限を付与してください。
[ec2-user@ip-X-X-X-X html]$ chmod 764 ec-cube/bin/console
[ec2-user@ip-X-X-X-X html]$

composer.jsonが配置されたディレクトリに移動し、composerインストールを行う
[ec2-user@ip-X-X-X-X html]$ cd ec-cube/
[ec2-user@ip-X-X-X-X ec-cube]$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 164 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.4.2): Downloading (100%)         
  - Installing ec-cube/plugin-installer (0.0.8): Downloading (100%)         
  - Installing kylekatarnls/update-helper (1.2.0): Downloading (100%)         
  - Installing symfony/flex (v1.8.4): Downloading (100%)         

Prefetching 160 packages 🎶 💨
  - Downloading (100%)

  - Installing symfony/process (v3.4.42): Loading from cache
  - Installing symfony/finder (v3.4.42): Loading from cache
  - Installing symfony/polyfill-ctype (v1.17.1): Loading from cache
  - Installing symfony/filesystem (v3.4.42): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.17.1): Loading from cache
  - Installing psr/log (1.1.2): Loading from cache
  - Installing symfony/debug (v3.4.42): Loading from cache
  - Installing symfony/console (v3.4.42): Loading from cache
  - Installing seld/phar-utils (1.0.1): Loading from cache
  - Installing seld/jsonlint (1.7.2): Loading from cache
  - Installing justinrainbow/json-schema (5.2.9): Loading from cache
  - Installing composer/xdebug-handler (1.4.0): Loading from cache
  - Installing composer/spdx-licenses (1.5.2): Loading from cache
  - Installing composer/semver (1.5.0): Loading from cache
  - Installing composer/ca-bundle (1.2.4): Loading from cache
  - Installing composer/composer (1.9.1): Loading from cache
  - Installing doctrine/collections (1.6.4): Loading from cache
  - Installing doctrine/lexer (1.0.2): Loading from cache
  - Installing doctrine/annotations (v1.8.0): Loading from cache
  - Installing doctrine/reflection (v1.0.0): Loading from cache
  - Installing doctrine/event-manager (1.1.0): Loading from cache
  - Installing doctrine/cache (1.9.1): Loading from cache
  - Installing doctrine/persistence (1.2.0): Loading from cache
  - Installing doctrine/inflector (1.3.1): Loading from cache
  - Installing doctrine/common (v2.11.0): Loading from cache
  - Installing symfony/doctrine-bridge (v3.4.42): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.5): Loading from cache
  - Installing symfony/polyfill-util (v1.17.1): Loading from cache
  - Installing symfony/polyfill-php56 (v1.17.1): Loading from cache
  - Installing paragonie/random_compat (v9.99.99): Loading from cache
  - Installing symfony/polyfill-php70 (v1.17.1): Loading from cache
  - Installing symfony/http-foundation (v3.4.42): Loading from cache
  - Installing symfony/event-dispatcher (v3.4.42): Loading from cache
  - Installing symfony/http-kernel (v3.4.42): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/dependency-injection (v3.4.42): Loading from cache
  - Installing symfony/config (v3.4.42): Loading from cache
  - Installing doctrine/instantiator (1.3.0): Loading from cache
  - Installing doctrine/dbal (v2.9.3): Loading from cache
  - Installing doctrine/orm (v2.7.0): Loading from cache
  - Installing symfony/routing (v3.4.42): Loading from cache
  - Installing symfony/class-loader (v3.4.42): Loading from cache
  - Installing symfony/polyfill-apcu (v1.17.1): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing symfony/cache (v3.4.42): Loading from cache
  - Installing symfony/framework-bundle (v3.4.42): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/doctrine-bundle (1.12.0): Loading from cache
  - Installing doctrine/data-fixtures (1.3.3): Loading from cache
  - Installing doctrine/doctrine-fixtures-bundle (3.3.0): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
  - Installing zendframework/zend-code (3.4.0): Loading from cache
  - Installing ocramius/proxy-manager (2.1.1): Loading from cache
  - Installing doctrine/migrations (v1.8.1): Loading from cache
  - Installing egulias/email-validator (2.1.11): Loading from cache
  - Installing symfony/stopwatch (v3.4.42): Loading from cache
  - Installing symfony/polyfill-php72 (v1.17.0): Loading from cache
  - Installing symfony/options-resolver (v3.4.42): Loading from cache
  - Installing php-cs-fixer/diff (v1.3.0): Loading from cache
  - Installing friendsofphp/php-cs-fixer (v2.16.1): Loading from cache
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache
  - Installing twig/twig (v2.12.2): Loading from cache
  - Installing knplabs/knp-components (v1.3.10): Loading from cache
  - Installing knplabs/knp-paginator-bundle (v2.8.0): Loading from cache
  - Installing symfony/translation (v3.4.42): Loading from cache
  - Installing nesbot/carbon (1.39.1): Loading from cache
  - Installing pimple/pimple (v1.1.1): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing ralouphie/getallheaders (3.0.3): Loading from cache
  - Installing sensio/framework-extra-bundle (v5.4.1): Loading from cache
  - Installing symfony/yaml (v3.4.42): Loading from cache
  - Installing sensio/generator-bundle (v3.1.7): Loading from cache
  - Installing tecnickcom/tcpdf (6.3.2): Loading from cache
  - Installing setasign/fpdi (v2.2.0): Loading from cache
  - Installing setasign/fpdi-tcpdf (v2.2.0): Loading from cache
  - Installing skorp/detect-incompatible-samesite-useragents (1.0.0): Loading from cache
  - Installing mobiledetect/mobiledetectlib (2.8.34): Loading from cache
  - Installing suncat/mobile-detect-bundle (v1.1.1): Loading from cache
  - Installing symfony/asset (v3.4.42): Loading from cache
  - Installing symfony/var-dumper (v3.4.42): Loading from cache
  - Installing symfony/twig-bridge (v3.4.42): Loading from cache
  - Installing symfony/twig-bundle (v3.4.42): Loading from cache
  - Installing symfony/web-profiler-bundle (v3.4.42): Loading from cache
  - Installing symfony/profiler-pack (v1.0.4): Loading from cache
  - Installing monolog/monolog (1.25.2): Loading from cache
  - Installing symfony/monolog-bridge (v3.4.42): Loading from cache
  - Installing symfony/monolog-bundle (v3.5.0): Loading from cache
  - Installing symfony/debug-bundle (v3.4.42): Loading from cache
  - Installing symfony/debug-pack (v1.0.8): Loading from cache
  - Installing symfony/dotenv (v3.4.42): Loading from cache
  - Installing symfony/expression-language (v3.4.42): Loading from cache
  - Installing symfony/inflector (v3.4.42): Loading from cache
  - Installing symfony/property-access (v3.4.42): Loading from cache
  - Installing symfony/intl (v3.4.42): Loading from cache
  - Installing symfony/polyfill-intl-icu (v1.17.1): Loading from cache
  - Installing symfony/form (v3.4.42): Loading from cache
  - Installing nikic/php-parser (v4.3.0): Loading from cache
  - Installing symfony/maker-bundle (v1.19.0): Loading from cache
  - Installing doctrine/doctrine-migrations-bundle (v1.3.2): Loading from cache
  - Installing symfony/orm-pack (v1.0.8): Loading from cache
  - Installing symfony/polyfill-iconv (v1.17.1): Loading from cache
  - Installing symfony/polyfill-intl-idn (v1.17.1): Loading from cache
  - Installing symfony/proxy-manager-bridge (v3.4.42): Loading from cache
  - Installing symfony/security (v3.4.42): Loading from cache
  - Installing symfony/security-bundle (v3.4.42): Loading from cache
  - Installing symfony/serializer (v3.4.42): Loading from cache
  - Installing swiftmailer/swiftmailer (v6.2.3): Loading from cache
  - Installing symfony/swiftmailer-bundle (v3.3.1): Loading from cache
  - Installing symfony/templating (v3.4.42): Loading from cache
  - Installing symfony/validator (v3.4.42): Loading from cache
  - Installing symfony/web-server-bundle (v3.4.42): Loading from cache
  - Installing symfony/workflow (v3.4.42): Loading from cache
  - Installing twig/extensions (v1.5.4): Loading from cache
  - Installing vlucas/phpdotenv (v2.4.0): Loading from cache
  - Installing fzaninotto/faker (v1.9.0): Loading from cache
  - Installing bheller/images-generator (1.0.1): Loading from cache
  - Installing guzzlehttp/psr7 (1.6.1): Loading from cache
  - Installing guzzlehttp/guzzle (6.4.1): Loading from cache
  - Installing captbaritone/mailcatcher-codeception-module (1.2.1): Loading from cache
  - Installing symfony/dom-crawler (v3.4.42): Loading from cache
  - Installing symfony/css-selector (v3.4.42): Loading from cache
  - Installing symfony/browser-kit (v3.4.42): Loading from cache
  - Installing facebook/webdriver (1.7.1): Loading from cache
  - Installing sebastian/diff (2.0.1): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.2): Loading from cache
  - Installing sebastian/comparator (2.1.3): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/global-state (2.0.0): Loading from cache
  - Installing sebastian/environment (3.1.0): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/phpunit-mock-objects (5.0.10): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.5): Loading from cache
  - Installing theseer/tokenizer (1.1.3): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-token-stream (2.0.2): Loading from cache
  - Installing phpunit/php-code-coverage (5.3.2): Loading from cache
  - Installing webmozart/assert (1.6.0): Loading from cache
  - Installing phpdocumentor/reflection-common (2.0.0): Loading from cache
  - Installing phpdocumentor/type-resolver (1.0.1): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.2): Loading from cache
  - Installing phpspec/prophecy (1.9.0): Loading from cache
  - Installing phar-io/version (1.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.1): Loading from cache
  - Installing myclabs/deep-copy (1.9.3): Loading from cache
  - Installing phpunit/phpunit (6.5.14): Loading from cache
  - Installing codeception/phpunit-wrapper (6.7.1): Loading from cache
  - Installing codeception/stub (2.1.0): Loading from cache
  - Installing behat/gherkin (v4.6.0): Loading from cache
  - Installing codeception/codeception (2.4.5): Loading from cache
  - Installing dama/doctrine-test-bundle (v5.0.5): Loading from cache
  - Installing easycorp/easy-log-handler (v1.0.9): Loading from cache
  - Installing mikey179/vfsstream (v1.6.8): Loading from cache
  - Installing php-coveralls/php-coveralls (v2.2.0): Loading from cache
  - Installing symfony/phpunit-bridge (v3.4.42): Loading from cache
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package sensio/generator-bundle is abandoned, you should avoid using it. Use symfony/maker-bundle instead.
Package setasign/fpdi-tcpdf is abandoned, you should avoid using it. No replacement was suggested.
Package facebook/webdriver is abandoned, you should avoid using it. Use php-webdriver/webdriver instead.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Package easycorp/easy-log-handler is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
Deprecation Notice: Class Plugin\EntityExtension\Entity\CustomerSortNoTrait located in ./app/Plugin/EntityExtension/Entity/CustomerRankTrait.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
55 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear --no-warmup [OK]
Executing script cache:warmup --no-optional-warmers [OK]
Executing script assets:install --symlink --relative html [OK]

[ec2-user@ip-X-X-X-X ec-cube]$

EC-CUBEをインストールする
[ec2-user@ip-X-X-X-X ec-cube]$ bin/console eccube:install

EC-CUBE Installer Interactive Wizard
====================================

 If you prefer to not use this interactive wizard, define the environment valiables as follows:
 
  $ export APP_ENV=dev
  $ export APP_DEBUG=1
  $ export DATABASE_URL=database_url
  $ export DATABASE_SERVER_VERSION=server_version
  $ export MAILER_URL=mailer_url
  $ export ECCUBE_AUTH_MAGIC=auth_magic
  ... and more
  $ php bin/console eccube:install --no-interaction
 

 Database Url [sqlite:///var/eccube.db]:
 > mysql://ユーザー名:パスワード@RDSエンドポイント/空DB名

 Mailer Url [null://localhost]:
 > smtp://smtp.gmail.com:465   #Gmailを使用

 Auth Magic [gwhbP8glr6aVlDik]:
 >   #テストのため入力せず進む

 !                                                                                                                      
 ! [CAUTION] Execute the installation process. All data is initialized.                                                 
 !                                                                                                                      

 Is it OK? (yes/no) [yes]:
 > yes  #インストール最終確認OK

 Run doctrine:database:create --if-not-exists...
 Database `eccube4` for connection named default already exists. Skipped.

 Run doctrine:schema:drop --force...
 
 Dropping database schema...

 [OK] Database schema dropped successfully!                                     


 Run doctrine:schema:create...
 
 ! [CAUTION] This operation should not be executed in a production environment! 

 Creating database schema...

 [OK] Database schema created successfully!                                     


 Run eccube:fixtures:load...
   > Finished Successful!

 Run cache:clear --no-warmup...
 
 // Clearing the cache for the dev environment with debug                       
 // true                                                                        

 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.    


                                                                                                                        
 [OK] EC-CUBE installation successful.                                                                                  
                                                                                                                        

[ec2-user@ip-X-X-X-X ec-cube]$

2. ブラウザでiPv4アドレス/ec-cube/ にアクセスする

この画像には alt 属性が指定されておらず、ファイル名は uJQlQ0jn3bUb2K-bfLpHw-Qly-aTYC5YgC_N1uPyhxZMxJbb_XAZ87zzols8nr9UU5WSXGHTW1jmGHt3fblxftIRhKY3A5CMK_vZoNc5BEm2YISW4fBEeR5NOJw7kPqt1mu1HBcV です

3. ブラウザでiPv4アドレス/ec-cube/admin/ にアクセスする

この画像には alt 属性が指定されておらず、ファイル名は K56QYCmeq8Ixhjnu4Z_2dOxWgWTmviothIzdZnNSKW0sDT9F8p8DJyRW1AONDI1pqhdpoCwP-OVhU-M3Cz6wstmNQb5LLs4H3Q2_RTTH0p1NrhbBtDBD_x101ME6umOQ8ZpXousP です

EC-CUBE4.0.4のインストール完了です!
ログインID「admin」、パスワード「password」でログインできます。

EC-CUBE4でできることをまとめた資料をご用意しています!
https://ec-cuber.jp/eccube4-download/

ダミーデータ作成

1. ec2-userのままコマンドを実行

ダミーデータ作成コマンドを実行する
[ec2-user@ip-X-X-X-X ec-cube]$ bin/console eccube:fixtures:generate
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ...100
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ...200
OOOOOOOOOOOOO16:05:03 WARNING   [translation] Translation not found. ["id" => "合計金額が不正です。","domain" => "messages","locale" => "ja"] ["file" => "/var/www/html/ec-cube/vendor/symfony/translation/LoggingTranslator.php","line" => 132,"class" => "Symfony\Component\Translation\LoggingTranslator","function" => "log","uid" => "c7430b8","user_id" => "N/A","session_id" => "N/A"]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ...300
(省略)
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ...1000

eccube:fixtures:generate success
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 2096104 bytes) in /var/www/html/ec-cube/vendor/easycorp/easy-log-handler/src/EasyLogFormatter.php on line 84
[ec2-user@ip-X-X-X-X ec-cube]$

バリデーションのエラーやメモリオーバーによるFatal Errorが発生してしまいましたが、
ある程度までは作成できました!
本来であれば会員データが100レコード、商品データが100レコード、注文データが1000レコード作成されるようです。

メモリ、256MBでは足りなかったみたいですね……。

この画像には alt 属性が指定されておらず、ファイル名は dKysUHVumkVPMFqdmsIryWZOS01NSejIZy5EGy1IB-shM8MP6dOa8JA6kXlEHyzBvCYuMWVHCKh1SPQMChLaFNd3UBhnw8GHk61OmwfDnY6VmDF6VeUlCNbjIkZj4pWcFqHut49V です

実際に商品一覧ページを見てみると、すごいことになっていました。
これがランダム文字列による商品データです。作成自体は出来ていることが確認できます。

バリデーションエラーの回避方法はまた後日として、
今回やりたかったことは概ね達成できました!

おわりに

これで、AWS環境にEC-CUBE4.0.4をインストールすることが出来ました。

上記の手順を確立させるまで寄り道回り道、エラーと戦ったり逃げたりしましたが、とても勉強になりました。
同じく困っている方がいらっしゃれば、少しでも参考になれば幸いです。

今度は寄り道回り道について、別でコラムを書きたいと思います!

以上、木下でした!

EC-CUBEのことはEC-CUBEのプロ「EC-CUBER」にご相談ください!
https://ec-cuber.jp/contact-us/