Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

megaman's avatar

homestead yaml file

I have been trying to setup homestead and am having difficultly

My understanding is that the following steps must be taken

installed virtualbox and vagrant

vagrant add the laravel/homestead box

download the laravel/homestead project with composer or git

use homestead init to create the homestead.yaml file

vagrant up the box

I have done steps 1-2 without a problem I think i have done step 3, it has created the following file structure

.git (folder) scripts (folder) src (folder) composer.json composer.lock homestead init LICENCE readme.md vagrantfile (note that there is no homestead.yaml file)

Is this what is supposed to happen?

I cannot do step 4, i dont have PHP installed on my host machine. Is there any other way to generate the yaml file?

finally i can run the init file, this produces the message "homestead initialised" in the console. what does this actually do.

0 likes
7 replies
sitesense's avatar

I assume you're using Windows if you don't have PHP installed so the paths below relate to Windows.

init creates a folder in your user directory called .homestead.

C:\Users\YourUserName\.homestead\

Within this folder are 3 files:

after.sh

#!/bin/sh

# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.

aliases

alias ..="cd .."
alias ...="cd ../.."

alias h='cd ~'
alias c='clear'

function serve() {
    if [[ "$1" && "$2" ]]
    then
        sudo dos2unix /vagrant/scripts/serve.sh
        sudo bash /vagrant/scripts/serve.sh "$1" "$2" 80
    else
        echo "Error: missing required parameters."
        echo "Usage: "
        echo "  serve domain path"
    fi
}

function serve-hhvm() {
    if [[ "$1" && "$2" ]]
    then
        sudo dos2unix /vagrant/scripts/serve-hhvm.sh
        sudo bash /vagrant/scripts/serve-hhvm.sh "$1" "$2" 80
    else
        echo "Error: missing required parameters."
        echo "Usage: "
        echo "  serve-hhvm domain path"
    fi
}

and finally Homestead.yaml

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: D:\Code
      to: /home/vagrant/Code

sites:
    - map: myapp.dev
      to: /home/vagrant/Code/myapp/public

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

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

# ports:
#     - send: 93000
#       to: 9300
#     - send: 7777
#       to: 777
#       protocol: udp

You could try creating the folder and files manually and see how you get on.

If you somehow managed to vagrant up without the yaml file, I'd run vagrant destroy and then vagrant up again after creating the above.

Good luck.

megaman's avatar

Am I able to put the .yaml file created by init into the directory which i put the laravel/homestead git into and vagrant up on that folder will i need to modify the vagrant file before i do this

sitesense's avatar

@megaman you likely could edit the vagrant file and change the path below:

confDir = $confDir ||= File.expand_path("~/.homestead")

BUT - I'd advise keeping a standard install. If you hit problems further down the line, getting help could be difficult if you've customised things like that.

megaman's avatar

i used vagrant add laravel/homestad this added the base box to C:\Users\yourusername.vagrant.d\boxes

I ran the git clone command in D:/projects I later intended to run vagrant up from here and store the running instance of the box here (have not got that far yet)

The init file which comes with homestead puts the YAML file in C:\Users\YourUserName.homestead\

2 questions Do i need to do anything with the vagrantfile which comes with the git homestead files? (normally, as a minimum, you need to configure this to load a specific box)

Where should the YAML file go?

What does the YAML file do that the vagrant file does not?

sitesense's avatar

Where should the YAML file go?

The yaml file goes in C:\Users\YourUserName\.homestead\ as mentioned above.

What does the YAML file do that the vagrant file does not?

The yaml file helps provision the VM by setting up the folders to be mapped for syncing and sets up Nginx to serve the sites that you specify in the yaml file, amongst other things.

You don't need to touch the vagrant file.

sitesense's avatar
Level 19

I suggest that you open up a command line and cd to your D: drive.

Run git clone https://github.com/laravel/homestead.git Homestead from there, which will create a Homestead folder on your D: drive.

When you wish to run the Vagrant commands, just open up a command line in your Homestead folder and run them from there.

You have no control over where the VM itself is created unless you start editing and customising the scripts.

When you run vagrant up for the first time, it will download a "base box" which by default will be placed in C:\Users\username\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead\0.2.6\virtualbox\box-disk1.vmdk

Your VM will be provisioned from this "base box" but will actually be stored in C:\Users\username\VirtualBox VMs\homestead

But I have to say, this whole thread is way more information than you need and will probably only add to your confusion.

Seriously, you don't need to know "who farted and which way it blew"!

Just follow the instructions below and you'll be good to go :)

http://laravel.com/docs/master/homestead

2 likes
megaman's avatar

I have successfully got homestead running.

In the end I ran git clone https://github.com/laravel/homestead.git Homestead (exactly the same as the documentation and best answer in this thread said)

ran init.sh from the directory i cloned to

then ran vagrant up from the directory which init.sh put the yaml file in

This leaves me with a few questions

I used vagrant box add laravel/homestead to add the box first, I used the exact command found in the documentation. Then i used the same git clone command which is found in the documentation yet when i ran vagrant up it failed to find the box and downloaded a different one

The original vagrant add command fetched hashicorp-VAGRANTSLASH-precise32 The vagrant up command fetched laravel-VAGRANTSLASH-homestead

Why? is the documentation out of date?

What use are the other files in the git clone folder (ie everything except the init.sh script)

Please or to participate in this conversation.