The Windows Subsystem for Linux (WSL) is a tool aimed at developers, allowing Linux-based technology to run on Windows systems. WSL 2 allows applications to run at near-native performance.
There are two variants of WSL:
- WSL 1 worked by mapping Linux kernel system calls to their corresponding Windows equivalents. This version was generally slower and offered worse compatibility as there's not always a one to one mapping betweeb the two operating systems.
- WSL 2, available since Windows 10 build 18917, ships a Linux kernel within Windows, which runs in the same hypervisor as Hyper-V. It means that your distributions are virtualised, with all of them sharing the same kernel, with reduced memory requirements compared to running separate VMs.
Install the necessary Windows components from an elevated shell:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
You'll then need to reboot to enable the hypervisor.
Defaulting to WSL 2
WSL 2 is an experimental feature not yet available outside of Insider Preview builds of Windows. See the upstream documentation for details on how to migrate to a version of Windows 10 that includes it.
We'd also recommend setting the default WSL version to back newly installed containers with:
wsl --set-default-version 2