How to setup WSL2 on Windows 10

Before Start

Enabling and configuring WSL2

Open the Windows PowerShell as Administrator (right-click and select Run as Administrator) and paste following commands to enable the WSL2 and the Virtual Machine Platform component.

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

After executing the commands above restart your computer, then download and install the WSL2 Linux kernel update package for x64 machines.