Windows Subsystem for Linux atau WSL merupakan sebuah subsystem windows untuk menjalankan perintah linux melalui teknologi virtualisasi yaitu virtual machine.
Perbedaan WSL 1 dan WSL 2
WSL 1
WSL 2
Install WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Cek Versi WSL
Update WSL 1 ke WSL 2
wsl --set-version Ubuntu-20.02 2
atau menggunakan perintah
wsl.exe --set-version Ubuntu 2
Untuk mengatur WSL 2 sebagai default bisa menggunakan perintah
wsl.exe --set-default-version 2
Macam-macam Distro yang ada di WSL
Folder WSL di Windows Explore
\\wsl$\Ubuntu
Membuat configuration wsl
[wsl2]memory=8GB # Limits VM memory in WSL 2processors=4 # Makes the WSL 2 VM use 4 virtual processorslocalhostForwarding=true # Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.
Restart-Service LxssManager
List configuration
[wsl2]
kernel=<path> # An absolute Windows path to a custom Linux kernel.
memory=<size> # How much memory to assign to the WSL2 VM.
processors=<number> # How many processors to assign to the WSL2 VM.
swap=<size> # How much swap space to add to the WSL2 VM. 0 for no swap file.
swapFile=<path> # An absolute Windows path to the swap vhd.
localhostForwarding=<bool> # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true).
# <path> entries must be absolute Windows paths with escaped backslashes, for example C:\\Users\\Ben\\kernel
# <size> entries must be size followed by unit, for example 8GB or 512MB
Masalah
Tidak bisa akses localhost wsl di windows
wsl --shutdown
0 komentar