3 homepage: https://docs.microsoft.com/en-us/windows/wsl/wsl2-index
5 WSL (Windows Subsystem for Linux) 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** before WSL can be used.
12 3. Not all systems can use WSL 2, so **WSL 1** is the **default**.
16 > This is a complete WSL installer that includes **_WSL 1_**, **_WSL 2_**
17 > (Hyper-V), and **_Ubuntu Linux_**.
19 > WSL 2 is not "version 2" of WSL, but more "layer 2" WSL 1 uses a Linux syscall
20 > wrapper around the Windows Kernel WSL 2 uses `VirtualMachinePlatform` and
21 > Hyper-V to run a full Linux kernel with 100% syscall compatibility.
23 After installing WSL and **Rebooting** you will be able to install Linux
24 variants from the Windows 10 Store:
26 - [Ubuntu Linux 20.04](https://www.microsoft.com/store/apps/9n6svws3rx71)
27 - [Alpine WSL](https://www.microsoft.com/store/apps/9p804crf0395)
29 ### How to Launch Linux
31 To Launch the default Linux:
37 To Launch a specific Linux:
41 wsl.exe -d Ubuntu-20.04
44 ### How to Set or Reset Root Password
47 wsl -d Ubuntu-20.04 -u root passwd
50 ### How to Run a Single Command
52 Assuming you want to run `ls ~/` as the default user:
58 Assuming your username is `app` and you wanted to run `ls`:
61 wsl -d Ubuntu-20.04 -u app -- ls ~/
64 ### How to Switch Between WSL 1 and WSL 2
66 Despite the name, WSL 2 is neither a "better" version of nor a replacement for
67 WSL 1. Rather WSL 1 uses a syscall wrapper (much like WINE) whereas WSL 2 uses
68 Hyper-V virtualization.
70 You can start a Linux install in either mode and switch between the two as
73 Either by setting the per Linux install:
80 wsl --set-version Ubuntu-20.04 1
82 wsl --set-version Ubuntu-20.04 2
85 Or by setting the global default:
88 wsl --set-default-version 1
90 wsl --set-default-version 2
93 Note that you _cannot_ set the mode before rebooting.
95 See also <https://docs.microsoft.com/en-us/windows/wsl/wsl2-index>.
97 ### How to Install Linux with PowerShell
99 You can download Linux from the Windows Store, or with `curl.exe` on the Command
103 curl.exe -L -o Ubuntu_2004_x64.appx https://aka.ms/wslubuntu2004
104 powershell Add-AppxPackage Ubuntu_2004_x64.appx
107 See also <https://docs.microsoft.com/en-us/windows/wsl/install-manual>.
109 ### Raw PowerShell Install Commands
111 This is already detailed at [webinstall.dev/wsl1](https://webinstall.dev/wsl1)
112 and [webinstall.dev/wsl2](https://webinstall.dev/wsl2)
114 See also <https://github.com/microsoft/WSL/issues/5014>
116 ### Errors: Feature Not Installed & Nested VMs
118 These errors are detailed at <https://webinstall.dev/wsl2>.
123 wsl --set-default-version 1
124 wsl --set-version Ubuntu-20.04 1
129 - https://docs.microsoft.com/en-us/windows/wsl/install-win10
130 - https://github.com/microsoft/WSL/issues/5014
131 - https://docs.microsoft.com/en-us/windows/wsl/wsl2-index
132 - https://aka.ms/wsl2kernel
133 - https://docs.microsoft.com/en-us/windows/wsl/install-manual