LoginSignup
2
2

More than 1 year has passed since last update.

VirtualBox+Vagrant+AnsibleでLaravel開発環境を構築その弐

Last updated at Posted at 2020-06-21

環境を作る度に色んなサイト見て調べてって・・・大変なので、コピペできるように纏めました。
ですが、別のミドルウェアなどに入れ替えたくなりました。

マシンスペック

  • Mac mini 2018
  • macOS Catalina(10.15.x)
  • Intel Core-i7 3.2GHz 6コア
  • メモリ 32GB
  • SSD 512GB

VM環境

  • CentOS 7.x
  • Nginx 1.x
  • PHP(PHP-FPM)7.3.xPHP(PHP-FPM)7.1.x
  • MariaDB 10.3.xMySQL5.7.x
  • Laravel 6.xLaravel5.x
  • リポジトリ → 要らない
    • Bitbucket
  • IPアドレス
    • 192.168.56.105
  • ユーザー/パスワード
    • root/vagrant
    • vagrant/vagrant
  • VM名
    • CentOS7

やること

  • Ansibleで自動構築

前提

まずは下記従って環境構築する
VirtualBox+Vagrant+AnsibleでLaravel開発環境を構築その壱

VagrantのBox再作成

$ cd <Boxを作成したディレクトリ>
$ vagrant halt
$ vagrant destroy
$ vagrant box remove CentOS7
$ rm -f CentOS7.box
$ rm -fdR .vagrant
$ vagrant package --base CentOS7 --output CentOS7.box
$ vagrant box add CentOS7 CentOS7.box

Ansibleで自動構築

新たに設定ファイル作りました!
https://github.com/bobtabo/ansible2

環境の構築

$ rm -fdR ansible
$ git clone https://github.com/bobtabo/ansible2.git ansible
$ vagrant up

※参考
【Ansible】Mysql5.7でrootユーザのパスワードを再設定etc...

動作確認

sudo vi /private/etc/hosts
★下記を点線内に編集
192.168.56.105 laravel6.local
---
192.168.56.105 laravel5.local
---
:wq

ブラウザで確認
http://laravel5.local/
無題.png

2
2
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
2
2