目前为止(2023年10月6日),最新的 Ubuntu 版本是 Ubuntu 22.04。你可以按照以下步骤在 Windows 上使用 WSL 安装 Ubuntu 22.04:
-
检查系统要求:
- 确保你的操作系统是 Windows 10 或更高版本,并已安装 Windows 10 的更新版本。
- 确保你的计算机的处理器架构是 x64。
- 启用 WSL 功能:
- 打开 PowerShell 终端(以管理员身份运行)。
- 运行以下命令来启用 WSL:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
-
安装 WSL 2:
- 在 PowerShell 终端中,运行以下命令来启用 Virtual Machine Platform 功能:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- 下载并安装 WSL 2 的适用于 x64 的 Linux 内核更新包:https://aka.ms/wsl2kernel
- 将 WSL 2 设置为默认版本:
wsl --set-default-version 2
- 在 PowerShell 终端中,运行以下命令来启用 Virtual Machine Platform 功能:
-
安装 Ubuntu 22.04:
- 打开 Microsoft Store 应用。
- 搜索 “Ubuntu”,选择 “Ubuntu 22.04” 或 “Ubuntu 22.04 LTS”。
- 点击 “获取” 或 “安装” 按钮,然后等待安装完成。
-
启动 Ubuntu 22.04:
- 在开始菜单中找到并打开 “Ubuntu 22.04”。
- 设置用户名和密码。
- 完成设置后,你将能够访问 Ubuntu 22.04 的命令行界面。
现在你已经成功在 Windows 上安装了 Ubuntu 22.04,并可以通过 WSL 来使用它。你可以运行 wsl -l -v
命令来查看已安装的 WSL 发行版及其版本。