Windows10でのLaravel Homestead構築方法 まとめ

Hi, this is dog-ears.
今回は、Windows10上でLaravel Homestead 環境構築をする方法について、まとめました。
This time, I summarized how to build Laravel Homestead environment on Windows 10.

■Laravel 5.8 Laravel Homestead (Official)
https://laravel.com/docs/5.8/homestead

Ok.Let’s go.

(1) Install virtual box

■virtual box
https://www.virtualbox.org/

(2) Install Vagrant

■Vagrant
https://www.vagrantup.com/

(3) Create project folder at local. And Open command Prompt. move to project folder

I will talk project folder as [project folder].

(4) Create box file
vagrant box add laravel/homestead

There is one question, and I answered “virtualbox".

(5) Clone Git repository
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead

At this point, the directory structure is as follows.
[project folder]
– Homestead

(6) Initialize& edit Homestead.yaml

Initialize

init.bat

next, create two folder.
code folder to place code,and .ssh folder to place ssh keys as follows.

[project folder]
– .ssh
– code
– Homestead

last, edit Homestead.yaml

folders:
- map: C:\[fullpath to project folder]\code
to: /home/vagrant/code

sites:
- map: homestead.test
to: /home/vagrant/code/public

There are two point.

write [full-path to project folder] at folders map.
(default [~/code] show some errors in my case )

At sites-map, It is recommended to use default 'homestead.test’.
Some other homepage use “homestead.app".
but “homested.app" is used and make something wrong.

(7) Edit host file

C:\Windows\System32\drivers\etc\hosts

192.168.10.10 homestead.test
(8) Create SSH Keys

move to .ssh folder. And execute follow.

ssh-keygen -t rsa

・id_rsa
・id_rsa.pub
are created.

(9) Start vagrant
vagrant up
(10) login with ssh
vagrant ssh

Everything is done.
After that,Install laravel as follows

sudo composer self-update
composer create-project laravel/laravel code --prefer-dist

and You can see your page in follow address.

http://homestead.test/

But, If you run laravel dusk (Browser test), Some errors are occured.

About the dusk environment construction, I will summarize in the next article.
Thank you.

laravel

Posted by dog-ears