WSL 安装 Ubuntu 完整步骤(Windows 10/11 通用,极简无脑版)
一、检查系统要求Windows 10 2004 或 Windows 11推荐主板开启虚拟化Intel VT-x / AMD-V一般在 BIOS 里设置二、一键安装推荐以管理员身份打开 PowerShellWinX → 选择 “终端 (管理员)” 或 “PowerShell (管理员)”执行wsl --install --web-download自动启用 WSL、虚拟机平台、安装 WSL2 内核、下载 UbuntuMicrosoft Learn重启电脑必须三、首次启动 Ubuntu重启后会自动弹出 Ubuntu 窗口或手动打开 “Ubuntu” 应用提示输入用户名必须小写字母开头只能是小写字母、数字、-输入密码输入时不显示确认密码示例Enter new UNIX username: user01 New password: Retype new password:四、验证安装回到 PowerShellwsl -l -v看到类似NAME STATE VERSION * Ubuntu Running 2即成功。五、国内常用初始化换源 更新进入 Ubuntu 后# 备份原有源 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 替换为清华源复制整段 echo deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse | sudo tee /etc/apt/sources.list # 更新 sudo apt update sudo apt upgrade -y六、常见问题1. 提示 0x800701bc原因缺少 WSL2 内核解决wsl --update或手动下载安装https://aka.ms/wsl2kernel2. 下载慢 / 卡住重置商店缓存wsreset.exe或用离线包安装适合国内3. 用户名报错 NAME_REGEX只能用小写字母、数字、-必须字母开头4. 想装指定版本如 22.04wsl --install -d Ubuntu-22.04查看可安装列表wsl --list --online七、卸载wsl --unregister Ubuntu