Create Vagrant Windows Base Box With Virtualbox

  • Posted on: 25 December 2014
  • By: Zhijun Chen

Recently I've been trying to set up a Selenium Grid using Vagrant virtual machines, and one of the things I need is a Vagrant Windows base box.

  • Create and set up a Windows VM using Virtualbox

Open Virtualbox and click on new button to create a new Windows 8 (32 bit) virtual machine.

RAM settings: 1GB RAM.

Use virtual hard drive and select "Dynamically allocated" for storage.

Storage size: 16GB.

Install the operating system either from .iso file or cd disk.

Wait for the installation to complete and follow the instruction to create a local account. The username and password should both be "vagrant". Install software required in this VM, e.g. Chrome, Firefox, Java, etc.

Alternatively, you can use Chef to manage the software requirements.

  • Turn the Windows VM into Vagrant base box

Once the Windows VM is ready, we need to turn it into a Vagrant base box. Vagrant uses either SSH or Windows Remote Management to communicate with Windows. I use WinRM because it is more conventional. Here are the requirements:

    • Turn off UAC. To do this, press Ctrl+Esc to open start screen. Type "uac" under settings in search box, and drag the slider all the way to the bottom.

    • Disable complex passwords, under gpedit.msc

    • Disable "shutdown tracker", under gpedit.msc

To Enable and cnofigure WinRM you'll need to set the WinRM service to auto-start and allow unencrypted basic auth. Run the following commands from a regular Windows command prompt:

 winrm quickconfig -q winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"} winrm set winrm/config @{MaxTimeoutms="1800000"} winrm set winrm/config/service @{AllowUnencrypted="true"} winrm set winrm/config/service/auth @{Basic="true"} sc config WinRM start= auto
  • Use the base box

To Use the box, run the following command: 

vagrant box add my-box /path/to/the/
vagrant init my-box
vagrant up


Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.