Jump to part 2

Prerequisite Software

There is a small set of software that I recommend having installed before continuing with this guide. It’s not absolutely necessary, but it may prevent problems down the road.

  • Git with GitBash (I used version 2.8.1)
  • VirtualBox version 5.0.* (The latest version of, 5.1, wouldn’t work with Vagrant.)
  • Vagrant version 1.8.5
  • Composer version 1.1.2
  • PHPStorm 2016.2 (Required for later portion of guide but not necessary)

Installing Laravel and Homestead

I’m going to refer to a project that I made up named `filter-products`.

First, create an empty project directory using GitBash (or whatever). I’m going to refer to this directory as {PROJECT_DIRECTORY}

mkdir filter-products


Navigate into the newly created directory.

cd filter-products


Clone the laravel repository into the current directory using Git

git clone git@github.com:laravel/laravel.git .


Next, we’ll use composer to add homestead to our list of developer dependencies:

composer require laravel/homestead --dev


Remove the laravel .git repository directory. We’re going to replace it with a fresh repository.

rm -rf .git


Initialize a fresh repository:

git init


Next, we’ll commit our changes to the new repository.

git add --all


git commit -m "Initial commit of {INSERT YOUR PROJECT INFO HERE}"


We need to make the Homestead.yaml and VagrantFile file now. This can be done automatically for us. I had to use command prompt for this (not GitBash). Still within the root of {PROJECT_DIRECTORY}, run this command:

vendor\\bin\\homestead make


You should now have a VagrantFile and a Homestead.yaml file in the root of the project directory.

You can then stage the Vagrant file and commit it like we did earlier.

Open Homestead.yaml with an editor (PHPStorm or whatever). I used Sublime. Change the hostname to the test domain name you’ll be using. I used `filter-products.dev`. You can see a sample of this in the screenshot. Save and close the file when done.A sample homestead.yaml configuration file

The next part can go either of two ways. The windows `hosts` file will need to be modified to add our hostname. You can do this manually or let Vagrant attempt to modify the file. If you choose the latter, be sure you’re running GitBash or Command Prompt as an administrator.
However, if you choose to do this manually, you can add the following line to the Windows hosts file which is located in `C:\Windows\System32\drivers\etc`. You’ll need to modify this with administrator privileges. Use the hostname you’ll be using for development; the one you set in Homestead.yaml. Here’s the line I added to the hosts file:  filter-products.dev


We’re ready to fire up Homestead. Within the root of the project directory, use GitBash or Command Prompt to bring up Vagrant with the following command:

vagrant up


If all goes well, you should be able to use your browser and navigate to the developer hostname you chose in Homestead.yaml and see that the site is working, but Laravel isn’t quite correctly setup yet. The issue is that there is currently no .env file, which is required for Laravel to run.

SSH into the virtual machine (VM) with the command:

vagrant ssh


You’re not quite in the correct directory yet. You’ll need to navigate to the project directory within vagrant. In my case, I had to run the following command:

cd filter-products


Replace filter-products with your project’s directory name.

Next, create the .env file by copying the .env.example file.

cp .env.example .env


Then, run the PHP artisan command to generate a key. This will modify our new .env file, which adds an APP_KEY entry.

php artisan key:generate


Go back to your browser and refresh the page. You should now see a valid laravel intro page.

laravel1Jump to part 2