23 Oct 2018

Setting up Windows Subsystem for Linux (WSL) with Vagrant

Windows Subsystem for Linux or WSL is a powerful tool for implementing your development workflow in Windows 10. It allows you to execute BASH and other development setups. Vagrant is an abstraction layer where it provides an interface for you to work on a VM. This guide will just go through the different steps in configuring this development environment.

Steps

  1. Configure and setup the Windows Subsystem for Linux. Here is the link for the in-depth setup and configuration of WSL. Setup WSL in Windows 10
  2. Install Virtualbox and Vagrant for windows. You may need to restart your machine after installing vagrant. Vagarant Installer Virtualbox Installer
  3. Install vagrant to the WSL environment. The version of your vagrant must be the same as the version you have installed in windows.
  4. In your WSL terminal, configure the following WSL environment variables:

    export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
    export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
    export VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH="/mnt/e/Development"
    
  5. In your Vagrantfile, add the v.customize line in the config.vm.provider:

    v.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
    
  6. You can now run vagrant with WSL.

Tags: