vagrant Installation for Windows with VirtualBox and SSH support


Example

To use Vagrant on Windows platform you need to install virtualization software and an ssh command-line tool first. This example will use freeware VirtualBox and Cygwin.

Install VirtualBox

Download the latest VirtualBox version from the official download page and run the downloaded file. Note that during installation you will temporarily lose the network connection. Warning: Network Interfaces

You should also let Oracle install additional drivers.

Install Cygwin

Get it from cygwin.com and run the setup until you get the "Select packages" page.

We only need ssh bin-s from here: Cygwin SSH packages

Add Cygwin to PATH

You also need to add C:\cygwin64\bin folder to the Windows PATH environment variable. So that you may call ssh command from anywhere.

Install Vagrant itself

Download Vagrant from vagrantup.com and just follow the setup guide to install it. You have to restart your computer after this.

Testing

Virtualization technology VTx/VTd should be enabled. (You can find that in the BIOS in the security options)

To test if everything installed correctly create an empty folder somewhere on the hard drive, open the command line and move to the folder you just created:

cd c:/path/to/your/folder

then enter

vagrant init hashicorp/precise64
vagrant up

This will create and launch the VirtualBox running Ubuntu 12.04 LTS 64-bit To launch 32-bit version use vagrant init hashicorp/precise32. If you need another box you can find more at the website from hashicorp.

Also the vagrant init command will create a Vagrantfile configuration file in the current folder. Now you can simply send it to someone else and when that person calls vagrant up the same exact virtual machine will be created on his/her PC.

To test ssh after these two commands run successfully, run this command in the same folder:

vagrant ssh

If everything went well you will end up inside the virtual machine logged in as the vagrant user.

Further steps

You can stop the VM with

vagrant halt

or delete it with

vagrant destroy

More boxes along with the instructions how to install them can be found on the vagrantbox.es page.