How To Install WSL2 Windows Subsystem for Linux 2 in Windows 10
With release of Windows 10 Build 18917, Microsoft introduced WSL 2, the Windows Subsystem for Linux 2. It ships a real Linux kernel with Windows that will make full system call compatibility possible. This is the first time a Linux kernel is shipped with Windows. Today, we will see how to enable WSL 2 in Windows 10.
WSL 2 is a new version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version).
The architectural changes in WSL 2
WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine (VM). However, WSL 2 will NOT be a traditional VM experience. When you think of a VM, you probably think of something that is slow to boot up, exists in a very isolated environment, consumes lots of computer resources and requires your time to manage it. WSL 2 does not have these attributes. It will still give the remarkable benefits of WSL 1: High levels of integration between Windows and Linux, extremely fast boot times, small resource footprint, and best of all will require no VM configuration or management.
Key changes in WSL 2
There are some user experience changes that you’ll notice when you first start using WSL 2.
- File system access. You need to keep you files inside the Linux file system. To enjoy the faster file system access in WSL 2 these files must be inside of the Linux root file system. It is now possible for Windows apps to access the Linux root file system (like File Explorer, just try running:
explorer.exe /in your bash shell and see what happens) which will make this transition significantly easier.
- WSL global configuration: Since Insider Build 17093 you have been able to configure your WSL distros using
- Custom kernels. You may want to have a specific kernel powering your WSL 2 distros, such as using a certain kernel module, etc. You can now use the
kerneloption in the
.wslconfigfile to specify a path to a kernel on your machine, and that kernel will be loaded into the WSL 2 VM when it’s started. If no option is specified, you’ll go back to using the Linux kernel provided with Windows as part of WSL 2.
- You can use
localhostto connect to your Linux applications from Windows.
- Finally, WSL 2 is supported on ARM64 devices.
Let's see how to get WSL 2 installed in Windows 10
To Install Windows Subsystem for Linux 2 in Windows 10,
- Enable the classic WSL 1 option as detailed here.
- Now, open PowerShell as Administrator.
- Execute the following command:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform. You computer must have support for virtualization, e.g. Intel VT-x, AMD RVI.
- Restart Windows 10.
- Now, open PowerShell as Administrator again.
- List the available WSL distros using the command
wsl.exe -l -v. You will see the list of WSL distros and their versions.
- Issue the command
wsl --set-version <distro_name> 2. Subsitute the distro name with the actual distro name, e.g. Ubuntu:
wsl --set-version Ubuntu 2.
- Now, execute the command
wsl.exe -l -vonce again to verify that the distro is successfully converted. See the VERSION column.
You are done! The specified distro is now powered by WSL 2, bringing all its impressive features at your fingertips.
- List Available WSL Linux Distros in Windows 10
- Remove User from WSL Linux in Windows 10
- Add or Remove Sudo Users in WSL Linux in Windows 10
- Remove User From WSL Linux Distro in Windows 10
- Add User to WSL Linux Distro in Windows 10
- Update and Upgrade WSL Linux Distro in Windows 10
- Run WSL Linux Distro as Specific User in Windows 10
- Reset and Unregister WSL Linux Distro in Windows 10
- Reset Password for WSL Linux Distro in Windows 10
- All Ways to Run WSL Linux Distro in Windows 10
- Set Default WSL Linux Distro in Windows 10
- Find Running WSL Linux Distros in Windows 10
- Terminate Running WSL Linux Distro in Windows 10
- Remove Linux from Navigation Pane in Windows 10
- Export and Import WSL Linux Distro in Windows 10
- Access WSL Linux Files from Windows 10
- Enable WSL in Windows 10
- Set Default User for WSL in Windows 10
- Windows 10 Build 18836 Shows WSL/Linux File System in File Explorer