Files
nexus/wiki/sources/install-wsl.md
2026-04-24 00:03:01 +08:00

50 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Install WSL"
type: source
tags: []
date: 2026-04-18
---
## Source File
- [[Home Office/Install WSL]]
## Summary用中文描述
- 核心主题Windows Subsystem for LinuxWSL的官方安装与配置完整指南
- 问题域Windows 10/11 系统上快速安装 Linux 开发环境,包括单命令安装、多发行版支持、版本管理、离线安装等场景
- 方法/机制:① `wsl --install` 一键安装;② `-d` 参数切换默认发行版;③ `wsl.exe --set-default-version` 切换 WSL 1/2④ MSI 包 + DISM 命令离线安装;⑤ Windows Terminal / 开始菜单 / PowerShell 多入口运行
- 结论/价值微软官方权威安装文档提供从零到生产可用的完整路径WSL2 为默认版本,支持并行运行多个不同 Linux 发行版
## Key Claims用中文描述
- `wsl --install` 一条命令完成 WSL 全部组件启用和 Ubuntu 默认发行版安装,适用于 Windows 10 version 2004+Build 19041+)和 Windows 11
- WSL2 默认使用 NAT 网络模式,通过 `.wslconfig` 配置 `networkingMode=mirrored` 可实现与 Windows 共享网络堆栈(参考 [[WSL2 启动与网络配置指南]]
- 支持并行安装多个 Linux 发行版Ubuntu/Debian/SUSE/Kali/Fedora 等),可从 Microsoft Store 下载或导入自定义 TAR 分发版
- 新安装的 Linux 发行版默认使用 WSL 2可通过 `wsl.exe --set-version <Distro> 1` 降级到 WSL 1
- 离线安装需从 GitHub releases 下载 MSI 安装包,并通过 DISM 命令启用 Virtual Machine Platform 组件
## Key Quotes
> "You can now install everything you need to run WSL with a single command." — 微软官方文档
> "New Linux installations, installed using the `wsl --install` command, will be set to WSL 2 by default." — 微软官方文档
## Key Concepts
- [[WSL2]]Windows Subsystem for Linux 2Windows 10/11 内置 Linux 虚拟机环境,默认版本,支持完整 Linux 内核
- [[WSL1]]WSL 第一代,基于翻译层,性能较差但兼容性好,新发行版默认不使用
- [[WSL 安装命令]]`wsl --install` 单命令安装,启用所需功能并安装默认 Ubuntu 发行版
- [[多发行版支持]]WSL 支持并行安装运行多个不同 Linux 发行版,可通过 `--distribution` 参数指定运行哪个
- [[离线安装]]:通过 MSI 包 + DISM 命令手动启用 Virtual Machine Platform 组件,适用于无法联网的环境
## Key Entities
- [[Microsoft]]WSL 官方文档发布方
- [[Ubuntu]]WSL 默认安装的 Linux 发行版
- [[PowerShell]]Windows 命令行环境,执行 `wsl --install` 的工具(需管理员模式)
- [[Windows Terminal]]:微软官方终端应用,推荐用于运行 WSL支持多标签页
## Connections
- [[WSL2 启动与网络配置指南]] ← related_to ← [[Install WSL]](安装完成后需参考网络配置指南解决代理问题)
- [[Ubuntu Server]] ← related_to ← [[WSL2]]WSL2 中的 Ubuntu 与 Ubuntu Server 同属 Ubuntu 系 Linux 环境)
## Contradictions
- 与 [[WSL2 启动与网络配置指南]] 的侧重点差异:
- 冲突点:本文档聚焦安装过程,未涉及网络配置;[[WSL2 启动与网络配置指南]] 聚焦安装后的网络配置
- 当前观点:先安装(本文档)→ 后配置网络([[WSL2 启动与网络配置指南]]),两篇互补
- 对方观点WSL2 默认 NAT 网络模式下 localhost 代理不可用,需配置镜像模式才能与 Windows 共享代理