WSL2
WSL2 commands, restart wsl, set up wsl version
Install WSL2
- Enable WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- Enable VM feature
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
-
restart computer
-
download linux kernel
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
- set wsl2 as default
wsl --set-default-version 2
- check your distribution version
wsl --list --verbose
- update distribution wsl version
wsl --set-version <distribution name> <versionNumber>
move WSL2 to another disk
Run powershell.exe
as Administrator
PS C:\WINDOWS\system32> wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
# mkdir S:\ISOs\
PS C:\WINDOWS\system32> wsl --export Ubuntu S:\ISOs\ubuntu-wsl.tar
# mkdir w:\VMs
PS C:\WINDOWS\system32> cd w:\VMs
PS W:\VMs> mkdir ubuntu-wsl
PS W:\VMs> wsl --unregister Ubuntu
Unregistering...
PS W:\VMs> wsl --import Ubuntu W:\VMs\ubuntu-wsl S:\ISOs\ubuntu-wsl.tar
PS W:\VMs> wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
https://github.com/MicrosoftDocs/WSL/issues/412#issuecomment-575923176
Shutdown WSL
execute on cmd or powershell
wsl --shutdown