Install WSL2 on a Non-Default Drive
Enable the Windows Subsystem for Linux
Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Enable Virtual Machine feature
Open PowerShell as Administrator and run:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Restart computer then move to next step.
Download the Linux kernel update package
Download and run Latest WSL2 Linux kernel update package for x64 machines
Set WSL 2 as your default version
Open powershell and run:
wsl --set-default-version 2
Create a folder in a non-system drive
Create a folder for wsl like this: D:\WSL
Download a linux distro
Open powershell in newly created folder and run:
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
Alternatively, just download that linux distro using browser from distro list.
Unpack the downloaded distro
Run the following powershell commands:
move .\Ubuntu.appx .\Ubuntu.zipExpand-Archive .\Ubuntu.zip
Initialize linux distro
Run the following commands to initialize:
cd .\Ubuntu\.\ubuntu2004.exe
Then follow prompts to complete new user setup.