Windows 10 上適用於 Linux 的 Windows 子系統安裝指南Windows Subsystem for Linux Installation Guide for Windows 10

安裝適用於 Linux 的 Windows 子系統Install the Windows Subsystem for Linux

在安裝任何適用於 WSL 的 Linux 散發版本之前,您必須確定已啟用「適用於 Linux 的 Windows 子系統」選用功能: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

若要下載並安裝您慣用的散發版本,您有三個選擇:To download and install your preferred distro(s), you have three choices:

  1. 從 Microsoft Store 下載並安裝 (請參閱下文)Download and install from the Microsoft 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.

    Microsoft Store 中的 Linux 散發版本檢視

    下列連結會開啟每個散發套件的 Microsoft Store 頁面:The following links will open the Microsoft store page for each distribution:

  2. 從散發版本的頁面中,選取 [取得]From the distro's page, select "Get"

    Microsoft Store 中的 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
  • WslRegisterDistribution 失敗,發生錯誤 0x8007019eWslRegisterDistribution failed with error 0x8007019e

  • 未啟用適用於 Linux 的 Windows 子系統選用元件:The Windows Subsystem for Linux optional component is not enabled:

  • 開啟 [控制台] -> [程式和功能] -> [開啟或關閉 Windows 功能] -> 檢查適用於 Linux 的 Windows 子系統,或使用本文開頭所述的 PowerShell Cmdlet。Open Control Panel -> Programs and Features -> Turn Windows Feature on or off -> Check Windows Subsystem for Linux or using the PowerShell cmdlet mentioned at the begining of this article.