0
1

More than 3 years have passed since last update.

Magento2をインストールする

Last updated at Posted at 2021-03-29

Magento2をローカル環境にインストールする方法を順に説明していきます。

環境

  • MacOS Big Sur version 11.2.3
  • Virtual Box version 6.1.16
  • Vagrant version 2.2.9
  • git version 2.29.2

プレインストール

/etc/hostsファイルにIPアドレスとURLを追加します。

$ sudo apt install nfs-kernel-server

$ sudo vim /etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
192.168.200.50  dev.magento.com

インストール

1. 下記リンクのプロジェクトをクローンする

$ git clone git@github.com:zepgram/magento2-fast-vm.git

以降、より詳細な情報はmagento2-fast-vm-master/README.mdを参照してください。

2. magento2-fast-vm-master/ssh.exmaple/

ディレクトリ名をsshに変更して、配下に以下のファイルを配置する。

  • /Users/yourname/.ssh/id_rsa
  • /Users/yourname/.ssh/id_rsa.pub

3. magento2-fast-vm-master/config.yaml

ファイル名をconfig.yamlに変更して構成をカスタマイズします。

config.yaml
#これはデフォルト値です。
vmconf:
  machine_name: 'Vagrant Magento 2'
  network_ip: '192.168.200.50'
  host_name: 'zepgram'
  memory: '4096'
  cpus: '1'
  mount: 'nfs'
  path: 'root'
  provision: 'all'
composer:
  username: 'magentoUsernameKey'
  password: 'magentoPasswordKey'
git:
  name: 'John Doe'
  email: 'john@doe.com'
  host: 'github.com'
  repository: 'ssh://git@github.com:project-name.git'
magento:
  url: 'dev.magento.com'
  source: 'composer'
  edition: 'community'
  version: '2.4.2'
  php_version: 'default'
  sample: 'true'
  mode: 'developer'
  currency: 'USD'
  language: 'en_US'
  time_zone: 'America/New_York'
  crypt_key: ''

composer:username, passwordはMagentoアカウントを作成し取得します。

4. Magentoをインストールする

$ vagrant up
$ vagrant ssh

※vagrant upにはおよそ20分程度かかります。

接続情報

  • User bash terminal
    • user: vagrant
  • Back-office
    • url: magento[url]/admin
    • user: magento.admin
    • pass: admin123
  • Database
    • user: vagrant
    • pass: vagrant
    • name: magento
  • Mailcatcher
    • url: [network_ip]:1080
  • Adminer
    • url: [network_ip]/adminer
  • Phpinfo
    • url: [network_ip]/php
0
1
0

Register as a new user and use Qiita more conveniently

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