I’ve just been given a new Windows corporate laptop, with a huge amount of RAM (64GB), a large number of cores, and I wanted to start using this as my main development virtualisation platform. I do a lot of stuff with Vagrant, Ansible and VirtualBox and Windows hasn’t always been a welcome home for this setup. A more welcoming experience can be received through the Windows Linux Subsystem (WLSS) and is a big improvement over Cygwin. The instructions here used Debian 9.5 but should work on many other Linux distributions with minor modifications (i.e. package manager).

First install Debian (or other distro) from the official instructions (easiest way is through the MS App Store).

Then update the OS…

sudo apt-get update && sudo apt-get upgrade;

The install Python and pip…

sudo apt install python;
sudo apt install python-pip;

Now Ansible can be installed through pip…

sudo pip install ansible

Next download Vagrant and install it…

VAGRANT="https://releases.hashicorp.com/vagrant/2.1.5/vagrant_2.1.5_x86_64.deb";
wget "$VAGRANT";
sudo apt install ./$(basename "$VAGRANT");

If you’re behind a proxy you probably need this Vagrant plugin

vagrant plugin install vagrant-proxyconf;

Next install git…

sudo apt install git;

Finally we need to install VirtualBox. Don’t rush ahead and install the Linux version. I did and this and it does not work. Grab the latest Windows version and install that on the host system in the usual way.

Next back in the WLSS Debian shell we need to make a few modification to allow the Windows Version of VirtualBox to be used. Basically we allow Vagrant to access the Windows version of VB and set the proxy. Edit or delete these as necessary…

cd
echo 'export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"' >> .profile
echo 'export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"' >> .profile
echo 'export VAGRANT_HTTP_PROXY=${http_proxy}' >> .profile
source .profile

Next let’s clone a Vagrant / Ansible / Virtual project to test the setup out…

mkdir git && cd git;
git clone https://github.com/rhysmeister/Jenkins.git
cd Jenkins
vagrant up

This is one my own projects setting up a Jenkins instance. It’s fairly simple but it will test all components of the setup we have just installed.