Install Windows Subsystem for Linux 2 in Windows 10

Windows 10 Linux Icon

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 wsl.conf.
  • 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 kernel option in the .wslconfig file 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 localhost to 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,

  1. Enable the classic WSL 1 option as detailed here.
  2. Now, open PowerShell as Administrator.
  3. Execute the following command: Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform. You computer must have support for virtualization, e.g. Intel VT-x, AMD RVI.
  4. Restart Windows 10.
  5. Now, open PowerShell as Administrator again.
  6. List the available WSL distros using the command wsl.exe -l -v. You will see the list of WSL distros and their versions.
  7. 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.
  8. Now, execute the command wsl.exe -l -v once 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.

Related articles:

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.