3

I am new to laravel And I am still confused the configuration of Homestead.yaml

my laravel project resides in C:/wamp/www/laravel and in Homestead.yaml I configured it like below

folders: - map: /wamp/www/laravel to: /home/Vagrant/Code sites: - map: homestead.app to: /home/Vagrant/Code/Laravel/public databases: - homestead variables: - key: APP_ENV value: local 

What is wrong with this configuration?Also do I have to manually create

/home/Vagrant/Code 

and

/home/Vagrant/Code/Laravel/public? 

if yes,in which windows directory?I am confuse about the /home directories since i am using a windows 8 machine.

3
  • Can you access your homestead instance by doing homestead ssh? You don't have to create /home/Vagrant/Code, it should create it for you. You can verify that by doing homestead ssh and see what you have in there. Commented Jun 1, 2015 at 17:05
  • @Jeremy.Running homestead ssh inside Homestead folder gives this error "Warning: require(C:\Users\me\Homestead/../../autoload.php): failed to open stre am: No such file or directory in C:\Users\me\Homestead\homestead on line 13".But I can ssh if I run vagrant ssh inside Homestead folder.Does it mean I have to install laravel inside Homestead folder?Initially I installed laravel in my C:/wamp/www/laravel folder Commented Jun 2, 2015 at 12:10
  • If you are using homestead, yes you run the laravel app from your vagrant Box Commented Jun 2, 2015 at 13:14

1 Answer 1

10

Ah yes, homestead configuration have also puzzled me a lot. I can recommend you buy the ebook Easy Laravel 5 by Jason Gilmore, or read the homestead chapter for free online right here. It was his chapter on homestead configuration that helped me understand how to do it. The ebook also contains lots of other good stuff on Laravel 5 development, and is often updated.

Update: The Laravel 5 Beauty blog also has a very easy to understand guide on how to set up homestead for Laravel 5.1. both on Windows, Linux and Mac.

That said, I'll try to answer your question right here. Step 5 is how to set up the homestead configuration. And no, you do not have to creat the vagrant/Code folder yourself. It's an alias for the path you provide.

0. Install Composer if you haven't already.

Also add the composer bin to your path:

enter image description here

LINK TO BIGGER VERSION OF PICTURE BELOW

enter image description here


1. Make sure you have downloaded the latest version of Vagrant and Oracle VirtualBox


2. Add the laravel box: $ vagrant box add laravel/homestead


3. Install the Homestead CLI tools: $ composer global require "laravel/homestead=~2.0"


4. Create your .homestead folder:

$ cd -> Goes to your user folder

$ homestead init -> Creates the .homestead folder

Also note here that you need to have the .ssh folder including the id_rsa and id_rsa.pub file. If you don't have it in your user folder, follow this guide to get it..


5. Edit your Homestead.yaml file. I'll use my setup as an example here:

LINK TO BIGGER VERSION OF PICTURE BELOW

enter image description here


6. Go to C:\Windows\System32\drivers\etc\ and edit the hosts file. It will warn you and demand administrator rights. Just open it with admin control.

Edit your hosts file with the urls you set up in your homestead.yaml file:

# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 192.168.10.10 phpmyadmin.local 192.168.10.10 lara.local 192.168.10.10 todoparrot.local 

7. Run the following CLI commands to provision vagrant. To be honest, I'm not too sure what this does, but it kinds of restart vagrant so it'up to date with your homestead.yaml and hosts configurations.

$ vagrant global-status -> Note the little number that comes up at the start. Mine is 2a6e97d

$ vagrant provision 2a6e97d


8. Run $ homestead up, let it finish running and go to your url, in my case lara.local. Here is my screen:

enter image description here


I hope this wasn't too confusing. Setting up homestead is a real pain the first time, but when you "get" how it works, it becomes pure bliss to develop with.

If anything is unclear, please write a comment and I'll try to help :)

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't know I could provision by ID thanks for that command. +1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.