The Windows Subsystem for Linux (WSL) lets developers access the power of both Windows and Linux at the same time on a Windows machine, including Linux applications, utilities, and Bash command-line tools directly, without the overhead of a traditional virtual machine or dualboot setup.
Open PowerShell by right-clicking and selecting "Run as administrator". Enter the 'wsl --install' command and restart your machine when the installation finish. See How to install Linux on Windows with WSL for more information.
wsl --install
If the installation failed due to network error, you can disable the Windows Subsystem for Linux and Virtual Machine feature and restart your machine. Or if you just prefer step by step instructions, you can also install it manually. See Manual installation steps for older versions of WSL for more information.
Open PowerShell by right-clicking and selecting "Run as administrator" and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Open PowerShell by right-clicking and selecting "Run as administrator" and run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2