HashiCorp Vagrant provides the same, easy workflow regardless of your role as a developer, operator, or designer. It leverages a declarative configuration file that describes all your software requirements, packages, operating system configuration, users, and more.
This tutorial will guide you to install Vagrant on Windows using WSL 2 (Windows Subsystem for Linux) with VirtualBox provider.
The most important thing to mention:
- VirtualBox must be installed on Windows. Windows will handle the VirtualBox process which will create the VM through the Virtualization Type 2. Learn more about virtualization at https://www.ibm.com/cloud/learn/hypervisors.
- Vagrant must be installed on Linux (WSL 2). The Linux binary is required because the Windows version is not compatible with WSL 2.
- Windows 10 - version +19042.928
- VirtualBox - version +6.1.22 (Windows version)
- WSL 2
- (maybe) PowerShell Preview
Just go to the download page and download the VirtualBox executable for Windows, then run it:
Install WSL 2
You must use WSL2. To install it, check the official documentation. I'll not set the guide here because it changes all the time:
Now open PowerShell and check if it's working properly and you are using version 2:
Install PowerShell Preview
Depending on your Windows version, you may need to install the PowerShell Preview version. If that's the case, go to your current PowerShell version and run the following command:
This should open an installation wizard. Go through all the steps and finish the installation process. If it fails, you can try to install it from the Windows Store:
You must install Vagrant inside WSL. So you must download the Linux version.
Considering you're using Ubuntu 20.04, run:
Them you must enable WSL 2 support. To do that, append two lines into the
Hello world with Vagrant for WSL2
Now that you have everything installed and configured, let's create a simple hello world project.
You'll need to go to Windows files using the WSL, then run every Vagrant command from there:
- VirtualBox download page
- Vagrant Quick Start tutorial
- Vagrant and Windows Subsystem for Linux
- Install WSL 2 on Windows 10