1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HomesteadでLaravel環境構築

Last updated at Posted at 2019-04-30

HomesteadでLaravel環境構築

LaravelのWelcome画面が表示されるまでの手順.

環境

  • Mac

事前に導入しておく

  • Git
  • VIrtualBox
  • Vagrant

環境構築手順

Homesteadを利用する。

Download Homestead

# vagrant box add laravel/homestead

プロバイダはvirtualbox を選択

ホームディレクトリに移動しGitからクローン

# cd ~
# git clone https://github.com/laravel/homestead.git Homestead

Initialize Homestead

Homestead 初期化

# cd ~/Homestead
# bash init.sh

作成するVMの設定を変更

Homestad.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/code
      to: /home/vagrant/code

sites:
    - map: homestead.test
      to: /home/vagrant/code/sampleapp/public #変更

databases:
    - homestead

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# zray:
#  If you've already freely registered Z-Ray, you can place the token here.
#     - email: foo@bar.com
#       token: foo
#  Don't forget to ensure that you have 'zray: "true"' for your site.

ディレクトリ作成

# cd ~
# mkdir code

macのホストに追加

# vi ~/etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.10.10 homestead.test # 追加

Vagrant 起動

# cd ~/Homestad
# vagrant up
# vagrant ssh
# cd ~/code/
# composer create-project laravel/laravel sampleapp --prefer-dist "5.5.*"

ブラウザからアクセス

http://homestead.test
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?