Windows 配置 WSL (Ubuntu) 环境完整指南 1. 前言Windows Subsystem for Linux (WSL) 允许开发者在 Windows 上直接运行 Linux 环境无需双系统或虚拟机。本文将详细介绍在 Windows 10/11 上安装和配置 WSL 2 及 Ubuntu 发行版的完整步骤。2. 系统要求Windows 版本Windows 10 版本 2004 及更高版本内部版本 19041 及以上或 Windows 11。虚拟化支持确保 BIOS/UEFI 中已启用虚拟化技术Intel VT-x 或 AMD-V。存储空间建议预留至少 10 GB 可用磁盘空间。3. 启用 WSL 功能首先我们需要在 Windows 中启用 WSL 和虚拟机平台功能。Windows开始菜单右键点击“应用和功能” - 右侧“程序和功能” - “启用或关闭 Windows 功能”。勾选“适用于 Linux 的 Windows 子系统”和“虚拟机平台”。点击“确定”并重启计算机。4. 安装 Ubuntu 发行版4.1 通过 Microsoft Store 安装推荐打开 Windows应用商店 Microsoft Store。搜索“Ubuntu”点击获取并安装。5. 首次启动与配置 Ubuntu安装完成后从开始菜单启动“Ubuntu”。首次启动会进行解压请耐心等待几分钟。系统会提示你创建新的 UNIX 用户名和密码此用户将拥有 sudo 权限。# 示例首次启动后的配置过程 Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: yourusername New password: Retype new password: passwd: password updated successfully Installation successful!