In the past years I was envying my friends and colleagues that would use a Mac as development platform while I was stuck on Windows because of gaming.

I just couldn’t justify buying an Apple laptop just for my hobby programming.

But here comes Microsoft to the rescue and with WSL 2 you will stop being jelly of your friends on some *nix system as you will have access to the Windows Subsystem for Linux

Microsoft has also written better documentation than me but I hope the following steps will be shorter and more straighforward to follow.

1. Enable the WSL Feature

To do so we’re going to use Powershell as administrator. Open the start menu and find Powershell, then right click on it to “Run as Administrator”.

Paste the following line and hit enter:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2. Enable the Virtual Machine Platform

In the same shell paste the line below. If you have closed the shell from the previous step, re-open with another right click on Powershell from the start menu.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

3. Download and install an update

Download this update from Microsoft and install it.

This updates WSL 2 kernel.

4. Set WSL 2 as default

Same Powershell, different line to paste:

wsl --set-default-version 2

5. Install a Linux distro from the Microsoft Store

Open the Microsoft Store and search for the Linux distribution of your preference.

I suggest Ubuntu 20.04.

6. Profit??

Visual Studio Code supports WSL remote natively. Enjoy.