What does WSL mean?
WSL or Windows Subsystem for Linux is a compatibility layer that lets developers run a GNU/Linux environment including most command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup, it was only released for the 64 bits systems back in 2016 with the Anniversary Update of Windows 10 as known as Version 1607.
Microsoft announced WSL 2 a new version of WSL in 2019 that is powered by a real Linux kernel and features a completely new VM-based backend based on Hyper-V. This makes WSL 2 much faster than WSL 1, and it also allows you to run more demanding Linux applications on Windows.
some of the benefits of using WSL 2:
- You can run Linux command-line tools and applications directly on Windows.
- You can access your Windows files from within Linux.
- You can use Linux-specific development tools and libraries on Windows.
Installing WSL 2 in Windows 10:
WSL 2 requires at least Windows 10 Version 1903 ( Build 18362) for the x64 systems and Version 2004 ( Build 19041) for the ARM64 systems.
Note:
You can check your Windows 10 version by pressing the Windows logo key + R, type winver and select OK, Or enter the winver command in Windows Command Prompt. alert-info
In my case, it's the Build 19042
- Firstly, open the Windows Powershell as Administrator and run the following command :
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart code-box
- You also need to enable the "Virtual Machine Platform" optional component. To do this, run the following command in PowerShell as Administrator:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart code-box
- To finish restart your machine to complete the WSL install and update to WSL 2.
Open now again PowerShell as Administrator and run this command to set WSL 2 as the default version when installing a new Linux distribution:
wsl --set-default-version 2 code-box
Note:
You might see this message after running that command: "WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel".
To resolve this issue, just go to this URL , and download and install the update file from it.
That's all, open now the Microsoft Store, search for your favorite Linux distribution like Ubuntu, OpenSUSE, Fedora or Kali Linux and install it to start using WSL 2 on Your Windows 10.