Skip to content

How to setup laravel project using homestead

  • by

Step 1 :

Create a new directory Homestead by using this command 

cd ~/Homestead

Step 2:

Install the homestead directory by cloning the homestead repository into the host machine, clone through 

git clone https://github.com/laravel/homestead.git

Step 3:

Go to homestead directory by command 

cd ~/Homestead

Step 4:

Checkout from the git release branch using command 

git checkout release

Step 5:

Execute the bash init.sh command from homestead directory , create a homestead.yaml file. This is the file where you will configure all the setting for homestead installation

For creation of yaml file execute this command 

bash init.sh

Step 6:

The folders property in homestead.yaml file , lists all the folders you wish to share with homestead environment

in map variable , you will place your host machine path, in to variable you will place your guest machine path

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

In map variable , Code is the folder placed in home directory, suppose project1 is your laravel project , placed in that folder

In to variable , same as code is the same folder as same as in the host machine in which project1 is the laravel project

Step 7:

In sites property you will easily map a domain to your homestead.yaml project.

Map property contain the domain name, configured in host file, and in to property is the path of your laravel project index file.

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

In Map property, homestead.test is the domain name and in To property contain the path of index file

Step 8:

add a host to host file, Go to cd etc, then nano hosts and add this address

192.168.10.10  homestead.test

Step 9:

Now again go to homestead directory and run command

vagrant up

Step 10:

After this ,run command

vagrant ssh

Step 11: 

Now project is running on that url

http://homestead.test

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.