How to Install Windows Subsystem for Linux 2 on Microsoft Windows 10?

From LHYcloud Docs
Jump to navigation Jump to search

What is the Windows Subsystem for Linux?

The Windows Subsystem for Linux (WSL) is a compatibility layer developed by Microsoft that allows you to run a Linux environment directly inside Windows, without needing a separate virtual machine or dual boot.

It enables developers and system administrators to use Linux tools, utilities, and applications side-by-side with Windows apps on the same computer.

Prerequisites for Installation

To follow this guide, make sure that your PC has Windows 10 Version 1903 (or later) with Build 18362 (or later).

Enabling WSL on Your Machine:

Open the Start menu by pressing the Windows-Key and search for “PowerShell”. Now right click on Windows PowerShell and click on “Run as administrator”.

Ww1.png


execute the following commands in a Windows Powershell terminal run as an Administrator:

dism.exe /online /enable-feature

/featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

In order to run the latest version of WSL, which is WSL 2, you need to enable “Windows Virtual Machine Platform”

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform

/all /norestart

For all the new changes and enabled features to take effect you need to restart your PC.

To install the default Ubuntu 20.04 distro, enter:

wsl --install

To install a specific distro by name, such as Debian, enter:

wsl --install -d Debian

Alternatively, you can install Linux distros from the Microsoft Store accessed in the Start menu. Enter “Linux” in the search box (be wary there could be software other than WSL distros).

Ww2.png

After choosing a username you will be prompted to create a password for this account.