-
Notifications
You must be signed in to change notification settings - Fork 0
windows wsl2
Kittipong R edited this page Sep 8, 2020
·
3 revisions
You will need Win10 build 2004 or later
Run in PowerShell with administrator privilege
### Enable WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
### Win10 (2004)
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
### Select WSL2
wsl --set-default-version 2
Reference:
- https://www.omgubuntu.co.uk/how-to-install-wsl2-on-windows-10
- https://medium.com/swlh/get-wsl2-working-on-windows-10-2ee84ef8ed43
In Microsoft Store, install...
- Windows Terminal
- Linux OS
As for Sept 2020, Hyper-V has a way of dynamically reserving thousands of ports that are normally used by different apps (sub-10K range). This sometimes make apps failed after a restart due to reservations. To fix this problem, we will move its reservation to 40K+ range.
### Show what ports are being reserved
netsh int ipv4 show excludedportrange protocol=tcp
netsh int ipv6 show excludedportrange protocol=tcp
### Change the range for dynamic ports
netsh int ipv4 set dynamic tcp start=49152 num=16384
netsh int ipv6 set dynamic tcp start=49152 num=16384
### Prevent port reservation
reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f
Reference: