Linux development on Windows with Vagrant and VirtualBox

February 12th, 2014

I’m doing some Linux-based server development at the moment, but my work machine runs Windows 7. I reckoned the best way to do this was to run a Linux VM, and a friend put me on to Vagrant, which is a crossplatform tool for managing VMs. Put simply, Vagrant allows you to build a VM according to a script, so that your whole build environment can be created repeatably on demand. This is really useful when a colleague joins your project, since you don’t have to spend a whole day remembering all the things you installed to make your build environment, and debugging issues with it not working on their machine.

Vagrant comes from the world of *nix, so it’s command-line driven and (as ever) such software doesn’t always play nicely with Linux. Here’s what I did to get it working on Windows 7.

  • Don’t bother getting any guest OSs for VirtualBox at this stage.

Vagrant needs an SSH client to work properly, and Windows doesn’t include one by default. It suggests using Cygwin, MinGW or git to provide one. I chose to use MinGW, which is a minimal set of tools to make Windows behave a lot more like a GNU system.

MinGW has a package-based installer – you download the installer, tell it which packages you want, and then it downloads and installs them for you.


  • get the latest MinGW installer from and then hit “Install” when it runs.
  • Keep the default installation directory (C:\MinGW) because like nearly all *nix tools, MinGW hates filepaths with spaces in. Make sure “install graphical user interface” remains ticked.
  • The installer should then open the package manager GUI (“MinGW Installation Manager”.
  • Go to Installation->Update Catalogue to ensure you have the latest package list.
  • Close the update dialogue box when it has finished.
  • Under “basic setup”, click on the checkbox next to msys-base and choose “Mark for installation”. Do the same for mingw32-base and mingw-gcc-g++.
  • Now go to “All packages” and scroll down to “msys-openssh”. Find the “bin” class and again mark for installation.
  • Finally, go to Installation->Apply Changes, and the system will download and install everything you need.

Finally finally, you need to alter that PATH environment variable so that Vagrant can find the ssh client:

  • Go to Control Panel->System And Security->System->Advanced System Settings and on the Advanced tab click “Environment Variables”.
  • Under “System Variables” scroll down to “Path” and click “Edit”.
  • The Variable Value box will be too small to contain the values, so carefully press your End key and add ;C:\MinGW\MSYS\1.0\bin to the end of the path. Note the semicolon that separates each individual path.
  • Having done that, close all the dialogue boxes and get a command prompt window. Follow the Vagrant introductory tutorial, it should all work now!