Windows安装WSL2+Ubuntu 22.04

系统要求

  • Windows 10 版本 2004 及以上(内部版本 19041 及以上)
  • 或 Windows 11
  • 64位系统
  • 已开启虚拟化功能(BIOS中启用)

🚀 安装步骤

1. 以管理员身份打开PowerShell
  • 右键点击开始菜单
  • 选择"Windows PowerShell(管理员)"或"终端(管理员)"
2. 启用WSL功能
powershell 复制代码
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
3. 重启电脑
powershell 复制代码
Restart-Computer
4. 设置WSL2

重启后,在管理员PowerShell中执行:

powershell 复制代码
# 设置WSL2为默认版本
wsl --set-default-version 2
5. 下载Ubuntu 22.04

https://mirrors.ustc.edu.cn/ubuntu-cloud-images/wsl/jammy/current/ubuntu-jammy-wsl-amd64-ubuntu22.04lts.rootfs.tar.gz

6. 更新WSL2内核组件
powershell 复制代码
wsl --update
7. 安装Ubuntu 22.04

D:\Ubuntu22.04是系统要放置的盘,放在C盘后续容器出问题

在ubuntu-jammy-wsl-arm64-ubuntu22.04lts.rootfs.tar.gz文件所在目录下执行

powershell 复制代码
wsl --import Ubuntu-22.04 D:\Ubuntu22.04 D:\Downloads\ubuntu-jammy-wsl-amd64-ubuntu22.04lts.rootfs.tar.gz --version 2

执行后会显示操作成功完成。

7. 进入系统
powershell 复制代码
wsl -d Ubuntu-22.04

会显示

powershell 复制代码
PS D:\Downloads> wsl -d Ubuntu-22.04
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.6.87.2-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Thu Mar 19 18:02:24 CST 2026

  System load:  0.22                Processes:             30
  Usage of /:   0.1% of 1006.85GB   Users logged in:       0
  Memory usage: 6%                  IPv4 address for eth0: 172.26.38.244
  Swap usage:   0%


This message is shown once a day. To disable it please create the
/root/.hushlogin file.
root@PC-20260318UDBG:/mnt/d/Downloads#
相关推荐
Moshow郑锴1 天前
Ubuntu 26.04 更换阿里云源镜像
linux·运维·ubuntu
Jason_chen1 天前
Linux 6.2 串口机制深度解析:AI驱动的自适应通信与零信任串口安全架构
linux
ShineWinsu1 天前
对于Linux:线程概念与分页存储管理的解析
linux·运维·服务器·面试·线程·进程·虚拟空间地址
用户3946235365241 天前
Uboot - DM框架
linux
鹤落晴春1 天前
RH124问答5:管理本地用户和组
linux·运维·服务器
callJJ1 天前
Volta + Claude Code 在 Windows 上的路径 Bug 复盘
windows·bug
其实防守也摸鱼1 天前
软件安全与漏洞--Windows底层原理与软件逆向工程基础
linux·网络·数据库·算法·安全·安全架构·软件安全与漏洞
云栖梦泽1 天前
Linux内核与驱动:pinctl子系统和GPIO子系统
linux·单片机·嵌入式硬件
女神下凡1 天前
这是 Cursor(Composer) 的五种核心交互模式
服务器·人工智能·windows·vscode·microsoft
techdashen1 天前
从 Windows 的 ping.exe 入手:动态库、调用约定与 Rust FFI
开发语言·windows·rust