Installing VirtualBox, Vagrant and Laravel Homestead

Video Tutorial.


Installing VirtualBox

VirtualBox helps us create and manage virtual machines which allows us to create development environments for PHP.

Head over to and download the latest version that’s suitable for your machine. Once downloaded, you can go ahead and click next and finish the dialogue setup. Once installed, you will be asked if you would like to open VirtualBox, you can untick and click finish since you won’t be needing the GUI for now.

Installing Vagrant

Vagrant can help us create and manage your machines through the command line. You can create your very own Vagrant boxes, or use a vast range of other Vagrant boxes.

Now you’ve installed VirtualBox, you can go ahead and install Vagrant. Head on over to and download the latest Vagrant version for your machine. You will have a choice between 32 and 64-bit versions of your OS. If you don’t know your version, you can take a look at this tutorial to learn more.

If you know your version, then select the correct one and once downloaded, you can begin to install. Again, it’s fairly straightforward and you can go ahead and stick with the defaults. Once finished, Vagrant will ask you to restart which you will do.

Installing and using Homestead

Homestead is a Vagrant box that helps us create a PHP development environment. You can use it with any PHP project and you’re not just limited to Laravel projects.

You don’t need to go over to Laravel for this part, but if you would like to, then I’ve left a link for you to follow.

First, you need to clone the Homestead repository into your user folder.

git clone ~/Homestead

Once cloned, you can cd into your directory cd ~/Homestead and checkout the release version git checkout release.

You now need to initialise your box by running bash if you’re on a bash terminal or init.bat if you’re running Command Prompt or Powershell.

Let’s create your first project by making a new folder in your “users” directory.

mkdir ~/codemkdir ~/code/public

In your public directory, you can go ahead and create an index.php file and type the following…

<?= 'Hello World' ?>

This is a short way of echoing out “Hello World”.

Before you run your new box, you need to make sure your hostname is created and pointed to your box. If you’re on Windows you can open up Notepad as an administrator and go to C:\Windows\System32\drivers\etc and open the hosts file. If you can’t see this file, then you need to click the dropdown at the bottom right of the dialogue and click “All Files”. Once you’ve done this you should see something similar to the below image.

At the bottom of your hosts file, you can add homestead.test and save your file.

Once done, you can head back to your terminal and run vagrant up. When it finishes, you can go into your browser and browse to http://homestead.test where you should see “Hello World” displayed.

If you see this message, then congratulations, you have successfully installed VirtualBox, Vagrant and Homestead.

Common Questions and Answers

Why won’t VirtualBox run on my machine?

The most common answer to this question is because you haven’t enabled secure virtualisation in your bios. You will need to restart your PC and enter your bios where you can then enable either AMD-V or Intel VT-X depending on your computer’s processor. This will be found in either the “Configuration” or “Security” section of your bios.

Enjoyed this post?

If you enjoyed this blog post, then please sign up as a member using the form below.

We will be looking into getting started with Laravel 6 and creating your first application. You will then later turn the app into an api which will allow you to seperate your frontend from your backend.

Leave a Reply

%d bloggers like this: