这里依据的是微软自己的教程
docs.microsoft.com/en-us/windo…
以WSL2为例
他有简单安装和手动安装两个方式
这里选择手动安装
第一步
启动Linux子系统
用管理员身份打开powershell,然后输入命令
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
第二步
检查win10版本,WSL2对版本有要求,如果只想安装WSL1,可以快进到第六步
To update to WSL 2, you must be running Windows 10.
- For x64 systems: Version 1903 or higher, with Build 18362 or higher.
- For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.
- Builds lower than 18362 do not support WSL 2. Use the Windows Update Assistant to update your version of Windows.
使用win+R ,打开winver
第三步
启用虚拟机功能
用powershell执行
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
然后重启电脑
第四步
安装Linux 内核更新包
wslstorestorage.blob.core.windows.net/wslblob/wsl…
第五步
将 WSL 2 设置为默认版本
用powershell执行
wsl --set-default-version 2
第六步
在微软应用商城安装Linux 发行版
第七步
安装完了启动之,然后需要设定初始的账号和密码
然后就安装完成了