新版
wsl --install
此命令将启用所需的可选组件,下载最新的 Linux 内核,将 WSL 2 设置为默认值,并安装Ubuntu。
安装其他发行版:
执行以下命令查看可安装发行版列表:
wsl --list --online
或者
wsl -l -o

安装Debian
wsl --install -d Debian
旧版
启用适用于 Linux 的 Windows 子系统
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
启用虚拟机功能
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
执行命令后需要重启电脑以完成 WSL 安装并更新到 WSL 2
下载 Linux 内核更新包
x64下载地址:https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
arm下载地址:https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_arm64.msi
如果不确定自己计算机的类型,执行以下代码查看:
systeminfo | find "系统类型"

将 WSL 2 设置为默认版本
wsl --set-default-version 2
安装Linux发行版
各个发行版的Microsoft Store 页面:
Ubuntu 18.04 LTS:https://www.microsoft.com/store/apps/9N9TNGVNDL3Q
Ubuntu 20.04 LTS:https://www.microsoft.com/store/apps/9n6svws3rx71
openSUSE Leap 15.1:https://www.microsoft.com/store/apps/9NJFZK00FGKV
SUSE Linux Enterprise Server 12 SP5:https://www.microsoft.com/store/apps/9MZ3D1TRP8T1
SUSE Linux Enterprise Server 15 SP1:https://www.microsoft.com/store/apps/9PN498VPMF3Z
Kali Linux:https://www.microsoft.com/store/apps/9PKR34TNCV07
Debian GNU/Linux:https://www.microsoft.com/store/apps/9MSVKQC78PK6
Fedora Remix for WSL:https://www.microsoft.com/store/apps/9n6gdm4k2hnc
Pengwin:https://www.microsoft.com/store/apps/9NV1GV1PXZ6P
Pengwin Enterprise:https://www.microsoft.com/store/apps/9N8LP0X93VCP
Alpine WSL:https://www.microsoft.com/store/apps/9p804crf0395
Raft(免费试用版):https://www.microsoft.com/store/apps/9msmjqd017x7
也可以在应用商店搜索想下载的发行版

如果下载速度过慢的话,打开【设置
->更新和安全
->传递优化
】把【允许从其他电脑下载
】的开关打开再下载。

原创文章,作者:小哆啦,如若转载,请注明出处:https://www.notevm.com/a/5932.html