3 homepage: https://docs.microsoft.com/en-us/windows/wsl/wsl2-index
5 WSL2 (Windows Subsystem for Linux 2) runs a true Linux kernel via Hyper-V virtualization.
10 1. WSL is a **system** service which **requires Admin privileges** to install.
11 2. A **System Reboot** is required **inbetween** install steps.
15 > WSL 2 uses `VirtualMachinePlatform` and Hyper-V to run a full Linux kernel
16 > with 100% syscall compatibility. However, it does not work on all computers
17 > and may not work in nested Virtual Machines - such as if running Windows in
18 > VirtualBox or Parallels on Mac or Linux.
20 This will install **WSL 1 and WSL 2 ONLY**.
22 **Most people** want [WSL 1 + WSL 2 + Linux](https://webinstall.dev/wsl). \
23 (WSL 2 is NOT a replacement for WSL 1, it's just another _layer_ of WSL)
25 See the **Full Cheat Sheet** at <https://webinstall.dev/wsl>.
27 ### How to Install Linux
29 Once WSL is installed you can download Linux from the Windows Store. We
32 - [Ubuntu Linux 20.04](https://www.microsoft.com/store/apps/9n6svws3rx71)
33 - [Alpine WSL](https://www.microsoft.com/store/apps/9p804crf0395)
35 ### How to Switch to WSL 2 Manually
37 To set WSL 2 for a specific Linux installation:
39 1. List all installed Linux versions
43 2. Set the desired version to WSL 2 with `--set-version`. For example:
45 wsl --set-version Ubuntu-20.04 2
48 If WSL 2 works on your computer, you may set it as the default:
51 wsl --set-default-version 2
54 ### How to install WSL 2 with PowerShell
56 If you'd like to install manually, or create your own script, this is how we do
61 dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
63 # Install VirtualMachinePlatform
64 dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
66 # Download and Install the WSL 2 Update (contains Microsoft Linux kernel)
67 & curl.exe -f -o wsl_update_x64.msi "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi"
68 powershell -Command "Start-Process msiexec -Wait -ArgumentList '/a ""wsl_update_x64.msi"" /quiet /qn TARGETDIR=""C:\Temp""'"
69 Copy-Item -Path "$env:TEMP\System32\lxss" -Destination "C:\System32" -Recurse
71 # Also install the WSL 2 update with a normal full install
72 powershell -Command "Start-Process msiexec -Wait -ArgumentList '/i','wsl_update_x64.msi','/quiet','/qn'"
75 See also <https://github.com/microsoft/WSL/issues/5014#issuecomment-692432322>
77 ### Error: Required Feature Not Installed
79 > Installing, this may take a few minutes...
81 > Error: 0xXXXXXXXX The virtual machine could not be started because a required
82 > feature is not installed.
84 It may be that your computer does not support virtualization because:
86 - it lacks hardware support in the CPU for VTx
87 - VTx is disabled in the BIOS or EFI
88 - Virtualization has disabled in Windows 10
90 You should switch back to WSL 1 until you solve this problem:
93 wsl --set-default-version 1
95 wsl --set-version Ubuntu-20.04 1
98 ### Error: Nested Virtual Machines
100 WSL2 may not work properly if you are already running Windows inside of a
101 Virtual Machine, especially if MacOS or Linux is the VM Host.
105 - https://docs.microsoft.com/en-us/windows/wsl/install-win10
106 - https://github.com/microsoft/WSL/issues/5014
107 - https://docs.microsoft.com/en-us/windows/wsl/wsl2-index
108 - https://aka.ms/wsl2kernel
109 - https://docs.microsoft.com/en-us/windows/wsl/install-manual