Instalasi WSL2ΒΆ

Konten berikut diambil dari https://gist.github.com/djibe/c60f6a055779ad89b5f84f81a2d337f7

  1. Check Windows Update is active.

2.1. Open Start menu: search for exploit > click on "Exploit protection" result.

2.2. Go to Program settings tab. Search for C:WINDOWSSystem32vmcompute.exe and

vmwp.exe.

2.3. On both: Edit > Code flow guard (CFG) > Override System Settings, set the

switch ON and check Strict CFG.

2.4. See previous steps with screenshots here https://www.cyberithub.com/solved-wslregisterdistribution-failed-with-error-0x80370114/

  1. Open Powershell.

4.1. Enable WSL2

DISM /Online /Enable-Feature /All /FeatureName:VirtualMachinePlatform /all /norestart
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Windows-Subsystem-Linux /all /norestart
wsl --update

wsl --set-default-version 2
wsl --shutdown

4.2 Activate long paths

Set-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1 -Type Dword
  1. Optional: define CPU + RAM allocation

6.1. Go to C:UsersUSERNAME directory and look for .wslconfig file. If absent,

create it. You can then specify the hardware that will be available for WSL. Save file.

6.2.

[wsl2]
memory=4GB # Limits VM memory in WSL 2 to 4 GB
processors=2 # Makes the WSL 2 VM use two virtual processors
  1. Install Debian/Ubuntu WSL2

wsl --install -d Debian
  1. Use Linux WSL2

9.1. Update Linux system

sudo apt update && sudo apt full-upgrade

9.2. We check that systemd is enabled.

sudo nano /etc/wsl.conf

9.3. The following lines should be displayed. If not, edit to reproduce it.

[boot]
systemd=true

9.4. Ctrl + O to save + Enter to confirm. Then Ctrl + X to close.

9.5. Exit WSL2

exit
  1. Restart WSL from PowerShell

wsl --shutdown
wsl