The Windows Subsystem for Linux has been around for a while. WSL1 allowed you to run some basic Linux distros in Windows. With the release of WSL2 the architecture will change drastically and will bring increased file system performance and full system call compatibility. WSL2 is now using virtualization technology (based on Hyper-V) and uses a lightweight utility VM on a real Linux kernel. You can read more about the benefits and changes of WSL2 in this Microsoft doc.
WSL2 Requirements on Windows 10
To install WSL 2, you will need the following requirements:
- Windows 10 Insider Preview Build 18917 or higher
- WSL 2 will be generally available in Windows 10 version 2004
- A computer that supports Hyper-V Virtualization
Enable the Windows Subsystem for Windows
- Open an elevated Powershell
- Run the command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- When prompted to reboot, you can now or later
Enable the Virtual Machine Platform feature
To make use of the virtualization feature for WSL2, you will need to enable the optional Windows feature Virtual Machine Platform.
- Open an elevated Powershell
- Run the command
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
- You’ll need to reboot to enable the feature
Set WSL Distro to Use WSL2 or Set as Default
- Open an elevated Powershell
- To set a specific distro, run
wsl --set-version DistroName 2
- To set it as the default, run
wsl --set-default-version 2
If you’re prompted to update the Linux Kernel, you can find the msi download and instructions in this Microsoft doc.
Install a Linux Distro from the Microsoft Store
- Open the Microsoft Store
- Search for the distro of your choice or search for Linux for some of the various options
Final Thoughts
WSL2 expands on the options of Linux on Windows 10. It is exciting to see what the options are and what the future holds. You can even RDP into your Linux instance for a full-blown GUI, but that’s for another article.