Linux 安装指南适用于 Windows 10 的 Windows 子系统Windows Subsystem for Linux Installation Guide for Windows 10

安装适用于 Linux 的 Windows 子系统Install the Windows Subsystem for Linux

在之前安装 WSL 任何 Linux 发行版,您必须确保"Windows 子系统为 Linux"已启用可选功能:Before installing any Linux distros for WSL, you must ensure that the "Windows Subsystem for Linux" optional feature is enabled:

  1. 以管理员身份打开 PowerShell 并运行:Open PowerShell as Administrator and run:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    
  2. 重新启动计算机时提示。Restart your computer when prompted.

安装所选的 Linux 分发版Install your Linux Distribution of Choice

若要下载并安装你首选的 distro(s),您具有三个选项:To download and install your preferred distro(s), you have three choices:

  1. 下载并安装来自 Windows 应用商店 (见下文)Download and install from the Windows Store (see below)
  2. 从命令行/脚本下载并安装 (读取手动安装说明)Download and install from the Command-Line/Script (read the manual installation instructions)
  3. 下载和手动解压缩并安装 (适用于 Windows Server-此处的说明)Download and manually unpack and install (for Windows Server - instructions here)

Windows 10 Fall Creators Update 及更高版本:从 Microsoft Store 安装Windows 10 Fall Creators Update and later: Install from the Microsoft Store

本部分是为 Windows 生成 16215 或更高版本。This section is for Windows build 16215 or later. 请按照这些步骤检查你的生成Follow these steps to check your build.

  1. 打开 Microsoft Store,然后选择你喜爱的 Linux 分发。Open the Microsoft Store and choose your favorite Linux distribution.

    在 Windows 应用商店中的 Linux 发行版的视图

    以下链接将打开每个分布区的 Windows 应用商店页:The following links will open the Windows store page for each distribution:

  2. 从发行版的页上,选择"Get"From the distro's page, select "Get"

    在 Windows 应用商店中的 Linux 发行版的视图

完成初始化的发行版Complete initialization of your distro

安装 Linux 发行版后,您必须初始化新的发行版实例一次,然后才能使用。Now that your Linux distro is installed, you must initialize your new distro instance once, before it can be used.

疑难解答:Troubleshooting:

以下是相关的错误的建议修补程序。Below are related errors and suggested fixes. 请参阅WSL 故障排除页其他常见的错误和其解决方案。Refer to the WSL troubleshooting page for other common errors and their solutions.

  • 安装失败,出现错误 0x80070003Installation failed with error 0x80070003
    • 系统驱动器上仅运行于 Linux 的 Windows 子系统 (通常这是你C:驱动器)。The Windows Subsystem for Linux only runs on your system drive (usually this is your C: drive). 请确保发行版都存储在您的系统驱动器上:Make sure that distros are stored on your system drive:
    • 打开设置 -> 存储 -> 更多的存储设置:保存新内容的更改 的系统设置的图片 c: 驱动器上安装应用Open Settings -> Storage -> More Storage Settings: Change where new content is saved Picture of system settings to install apps on C: drive