在win10-2004 在正式版中提供了wsl2。wsl命令已具備wslconfig的所有功能
添加wsl功能
啟用wsl
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
啟用wsl2所需的虛擬機平台
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
安裝wsl2內核更新 https://aka.ms/wsl2kernel
設置使用wsl2
wsl --set-default-version 2
wsl --set-version debian 2
常用命令
查看分發
wsl -l --all -v
重裝
wsl --unregister debian
debian install --root #--root表示使用默認的root賬戶
設置默認用戶
debian config --default-user root
查看幫助
wsl --help
使用社區支持的分發版
https://github.com/yuk7/wsldl(推薦)
https://github.com/DDoSolitary/LxRunOffline
https://github.com/RoliSoft/WSL-Distribution-Switcher
參考:
https://docs.microsoft.com/en-us/windows/wsl/about
https://docs.microsoft.com/en-us/windows/wsl/install-win10
