WSL 安装 Ubuntu 完整步骤(Windows 10/11 通用,极简无脑版)

一、检查系统要求

  • Windows 10 2004+ 或 Windows 11(推荐)
  • 主板开启虚拟化(Intel VT-x / AMD-V),一般在 BIOS 里设置

二、一键安装(推荐)

  1. 以管理员身份打开 PowerShell

    • Win+X → 选择 "终端 (管理员)" 或 "PowerShell (管理员)"
  2. 执行:

    bash 复制代码
    wsl --install --web-download
    • 自动启用 WSL、虚拟机平台、安装 WSL2 内核、下载 UbuntuMicrosoft Learn
  3. 重启电脑(必须)


三、首次启动 Ubuntu

重启后会自动弹出 Ubuntu 窗口,或手动打开 "Ubuntu" 应用:

  • 提示输入 用户名必须小写字母开头,只能是小写字母、数字、-
  • 输入密码(输入时不显示)
  • 确认密码

示例:

复制代码
Enter new UNIX username: user01
New password:
Retype new password:

四、验证安装

回到 PowerShell:

bash 复制代码
wsl -l -v

看到类似:

bash 复制代码
  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

2. 下载慢 / 卡住

  • 重置商店缓存:

    复制代码
    wsreset.exe
  • 或用离线包安装(适合国内)

3. 用户名报错 NAME_REGEX

  • 只能用 小写字母、数字、-必须字母开头

4. 想装指定版本(如 22.04)

复制代码
wsl --install -d Ubuntu-22.04

查看可安装列表:

复制代码
wsl --list --online

七、卸载

复制代码
wsl --unregister Ubuntu



相关推荐
orion571 天前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生3 天前
Linux 网络管理器用法速查
linux
顺风尿一寸3 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode3 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫4 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux