Windows: Enable (WSL) Windows Subsystem for Linux

Hi,

these are the steps to enable WSL (2) on Windows 10 >= 2004.

Open Powershell with administrator permissions (right click) and install the features VirtualMachinePlatform and Microsoft-Windows-Subsystem-Linux.

PS D:\> Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform,Microsoft-Windows-Subsystem-Linux,Microsoft-Hyper-V-All

Download and Install the kernel update

wsl.exe --set-default-version 2

List all distribution which can be installed

wsl -l -o

Install a distributon
The following distributions are currently available:

Ubuntu 20.04
Ubuntu 20.04 ARM
Ubuntu 18.04
Ubuntu 18.04 ARM
Ubuntu 16.04
Debian GNU/Linux
Kali Linux
OpenSUSE Leap 42
SUSE Linux Enterprise Server 12
Fedora Remix for WSL

Install it via the Microsoft store or, if you want it install offline, download the appx package over the link(s) an use Add-AppxPackage.

For example debian

PS D:\> Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile D:\temp\debian.appx -UseBasicParsing
PS D:\> Add-AppxPackage D:\temp\debian.appx

Start debian via the startmenu or from command line

$oPackage=Get-AppxPackage TheDebianProject.DebianGNULinux
[xml]$AppManifest=Get-Content ([System.IO.Path]::Combine($oPackage.InstallLocation,"AppxManifest.xml"))
$PackageFamilyName=$oPackage.PackageFamilyName
$AppId=$AppManifest.Package.Applications.Application.GetAttribute("Id")
Start-Process -FilePath "explorer.exe" ([String]::Format("shell:appsFolder\{0}!{1}",$PackageFamilyName,$AppId))
New user

Your local Windows disk are mount under /mnt. C: for example unter /mnt/c

You can also call every windows command line tool within the wsl container.

Michael

Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.