I am going to write down step by step procedure to setup homestead for Laravel-5.2 in windows 10 with virtualbox. I spent a lots of time to setup homestead for Laravel-5.2 in my windows 10 PC. I am writing this so that anybody could get benefit from this post. Well, enough talking. Lets dig in.
The official documentation for Laravel Homestead setup is: Official Documentation
N.B: Please try to type all the command instead of copy paste from this tutorial. It may cause unexpected error. See the response section bellow for more information.
As the official documentation says, you need to enable hardware virtualization (VT-x). to do it follow this site: http://www.howtogeek.com/213795/how-to-enable-intel-vt-x-in-your-computers-bios-or-uefi-firmware/
If this doesn’t help, then google it with your laptop model number or with your PC configuration. You must have to enable hardware virtualization (VT-x). And If you are using Hyper-V on a UEFI system you additionally need to disable Hyper-V in order to access VT-x.
After passing Step 1, now you need to download the latest version of virtualbox and vagrant.
Virtualbox download link: https://www.virtualbox.org/wiki/Downloads
vagrant download link: https://www.vagrantup.com/downloads.html
After downloading these, first install virtualbox. And then install vagrant. You may need to restart your PC after the installation complete.
Now we need to install git bash (if git bash is already installed in your PC, then skip this step).
Download link: https://git-scm.com/download/win
after downloading, install it.
Now open git bash in administrator mode and run the following command:
vagrant box add laravel/homestead
if you are now getting an error like this:
The box ‘laravel/homestead’ could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp’s Atlas, please verify you’re logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
then download this MS Visual C++ 2010 x86 Redistributables and install it. now run the following command again:
vagrant box add laravel/homestead
it should add the laravel/homestead box to your Vagrant installation. It will take a few minutes to download the box, depending on your Internet connection speed.
Now, after completing Step 4, type cd ~ on you git bash and hit enter. Now run the following command:
git clone https://github.com/laravel/homestead.git Homestead
it will clone the Homestead repository into a Homestead folder within your home (C:\Users\USER_NAME) directory.
now run the following two commands one by one:
this will create the Homestead.yaml configuration file. The Homestead.yamlfile will be placed in the C:\Users\USER_NAME\.homestead directory.
NB: (According to this #06b52c7 change, from Feb 17, 2017, theHomestead.yaml file will be now located on C:\Users\USER_NAME\Homestead folder)
Now we need ssh key. To check it is already exist in your computer or not go to C:\Users\USER_NAME\ directory and try to find out a folder named .ssh. If it exists, go into the folder and try to find out two files named id_rsa and id_rsa.pub. If the folder .ssh doesn’t exist or the folder exists but the two files named id_rsa and id_rsa.pub doesn’t exist then run the following command:
ssh-keygen -t rsa -C “firstname.lastname@example.org”
then the command prompt will ask you two things. you don’t need to type anything, just press enter what ever the command prompt ask you.
after finishing this command a new .ssh folder (if already not exist) will be created with the two files named id_rsa and id_rsa.pub into it.
Now we are going to edit the Homestead.yaml file which is generated in Step 5. This step is very very important. Go to the C:\Users\USER_NAME\.homestead directory. And now open the Homestead.yaml file with any text editor. The file will look like this:
— map: ~/Code
— map: homestead.app
# — id: foo
# token: bar
# client-id: foo
# client-token: bar
# — send: 50000
# to: 5000
# — send: 7777
# to: 777
# protocol: udp
I will explain the file step by step and also modify it to configure our homestead.
These lines say that on which ip address our homestead will listen and it is 192.168.10.10 (you can edit it)
how much memory will it consume (max) and it is 2048 (you can edit it)
it will use one CPU
and the provider is virtualbox.