Windows安装wsl(Linux子系统)方法

新版

wsl --install

此命令将启用所需的可选组件,下载最新的 Linux 内核,将 WSL 2 设置为默认值,并安装Ubuntu。如果不想安装Ubuntu的话,可以查看下面的旧版安装方法。

安装其他发行版:

执行以下命令查看可安装发行版列表:

wsl --list --online

或者

wsl -l -o
查看wsl可安装发行版列表
查看可安装发行版

安装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
Ubuntu 22.04 LTS:https://www.microsoft.com/store/apps/9PN20MSR04DW
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

也可以在应用商店搜索想下载的发行版

从应用商店搜索Linux子系统发行版
从应用商店搜索

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

打开允许从其他电脑下载
打开允许从其他电脑下载

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

(0)
小哆啦的头像小哆啦
上一篇 2022年5月29日 08:13
下一篇 2022年5月30日 10:18

相关推荐

发表回复

登录后才能评论