How to setup Homestead.

Matt Stypa
Laravel Made Simple
2 min readFeb 1, 2016

--

Now that we have vagrant going we could set up the entire stack by hand using our favorite flavor of Linux. Or, we could just use a premade box that is ready to go with everything we might need. Say hello to Homestead.

Homestead is Laravel’s official Vagrant box. It comes preconfigured with a lot of tools you might need. It really makes things a lot easier and quicker.

Notice

These instructions are specific to OS X. However, these concepts can be applied to other operating systems like Windows or Linux.

To install Homestead, we will pull its Vagrant file from GitHub. Git is already installed on OS X so just run this command in terminal:

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

We now have master branch of Homestead which may not be stable. Let find the latest release and switch to it.

cd Homestead
git tag // Lists all available tags
git checkout XXX // Replace XXX with the latest tag

At this point Homestead needs to be configured.

bash init.sh

This will create a configuration file but let’s leave it alone for now. Before we can start the VM we need to create a place for it to pull site files from. This is configured in the mentioned file but we can use the default location. Use this command to create the Code directory:

mkdir ~/code

If you want to use a different path you will need to edit the Homestead.yaml file.

One last piece we need is to tell our machine how to pull up Homestead website. To do that we need to edit a hosts file. Unfortunately, we are stuck using nano or vi. Run this command for nano:

sudo nano /etc/hosts

You will be required to enter your password because we are editing a secured system file.

Add this line:

192.168.10.10 homestead.test

Save your changes and exit.

Start the Homestead box with this commend:

vagrant up

We are done, but when you try to visit http://homestead.test, you will not get anything. This is because Laravel is not yet installed. We will do that next.

--

--

Matt Stypa
Laravel Made Simple

Calm work culture advocate. Open source contributor. Lead software engineer @ http://neighborhoods.com