在Windows 系统上安装Linux,在 Windows Server 上安装 Linux 子系统 | Microsoft Docs

Windows Server 安装指南Windows Server Installation Guide

05/12/2020

本文内容

适用于 Linux 的 Windows 子系统可供在 Windows Server 2019(版本 1709)和更高版本上安装。The Windows Subsystem for Linux is available for installation on Windows Server 2019 (version 1709) and later. 本指南将指导你完成在计算机上启用 WSL 的步骤。This guide will walk through the steps of enabling WSL on your machine.

启用适用于 Linux 的 Windows 子系统Enable the Windows Subsystem for Linux

必须启用“适用于 Linux 的 Windows 子系统”可选功能并重启,然后才能在 Windows 上运行 Linux 发行版。Before you can run Linux distros on Windows, you must enable the "Windows Subsystem for Linux" optional feature and reboot.

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

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

下载 Linux 分发版Download a Linux distribution

按照这些说明下载你最喜爱的 Linux 发行版。Follow these instructions to download your favorite Linux distribution.

提取并安装 Linux 分发版Extract and install a Linux distribution

下载 Linux 分发版后,若要提取其内容并进行手动安装,请执行以下步骤:Now that you've downloaded a Linux distribution, in order to extract its contents and manually install, follow these steps:

使用 PowerShell 提取 .appx 包的内容:Extract the .appx package's contents, using PowerShell:

Rename-Item .\Ubuntu.appx .\Ubuntu.zip

Expand-Archive .\Ubuntu.zip .\Ubuntu

在目标文件夹中运行分发版启动器应用程序。Run the distribution launcher application in the target folder. 启动器通常命名为 .exe(例如,ubuntu.exe)。The launcher is typically named .exe (for example, ubuntu.exe).

a99193a9aebc1a28f645f03bae67e75f.png

注意

安装失败并出现错误 0x8007007e:如果收到此错误,则表明系统不支持 WSL。Installation failed with error 0x8007007e: If you receive this error, then your system doesn't support WSL. 请确保运行的是 Windows 版本 16215 或更高版本。Ensure that you're running Windows build 16215 or later. 另外,请进行检查以确认 WSL 已启用,并且在启用此功能后重新启动了计算机。Also check to confirm that WSL is enabled and your computer was restarted after the feature was enabled.

3. 使用 PowerShell 将你的分发版路径添加到 Windows 环境路径(在本例中为 C:\Users\Administrator\Ubuntu):3.Add your distro path to the Windows environment PATH (C:\Users\Administrator\Ubuntu in this example), using PowerShell:

$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")

[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")

现在,可以通过键入 .exe 从任何路径启动你的分发版。You can now launch your distribution from any path by typing .exe. 例如: ubuntu.exe。For example: ubuntu.exe.

安装了分发版后,必须先初始化新的分发版实例,然后才能使用它。Now that it is installed, you must initialize your new distribution instance before using it.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值