How to Install Vagrant with VirtualBox on Windows

Published on Thursday, 28 June 2018

How to use Vagrant with VirtualBox on Windows

Great thing about Virtual Box is its free and will run on both Home and Pro versions of windows. Downside to it however is it won't support some of the advanced features like Nested Virtualisation though.

Other nice thing about using VirtualBox is this was the first hyperviosor supported by Vagrant so its support is probably some of the best.

Installing Vagrant

To install browse to https://www.virtualbox.org/wiki/Downloads and download the version for your machine (if your running a 64bit version of windows get the 64bit version).

Run through the installation wizard selecting all the default options.

I recommend you use the install off the web site instead of trying to use the Vagrant package. There has been some issues with the package in the past.

Installing Vagrant

Now to install vagrant itself. You can do this by downloading the installer from here or running the following chocolatey command:

choco install vagrant -yes

Close and reopen any powershell windows you have open at this point.

Note: By default vagrant will download large files and store configuration in a folder called .vagrant.d in your user profile. If you want to move this to another location you can do so with the VAGRANT_HOME environment variable.

Set default Provider

Last step is to set the VAGRANT_DEFAULT_PROVIDER to virtualbox. Doing this will cause vagrant to use VMware as its default provider. If you don't you might have vagrant try and download virtual box which is not what you want.

Testing Vagrant works

In a blank directory that you want to create your VM in run the following commands:

vagrant init hashicorp/precise
vagrant up
vagrant ssh

You should now have an SSH session into a virtual machine. To clean up use the following command:

vagrant destroy