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#
相关推荐
学linux的QQ蛋10 分钟前
sys文件系统与misc文件系统学习小总结
linux·学习·驱动
曦夜日长9 小时前
Git系统篇,Git本地使用(一):从“究极进化版“到三个区域的底层原理
大数据·linux·git·elasticsearch
shimly1234569 小时前
给断网无 sudo ubuntu22.04 机器安装 nodejs
linux
别动我齐刘海11 小时前
Linux 系统调试学习1
linux·运维·服务器·c++·学习·机器学习·机器人
Lsetea11 小时前
OpenSSL报certificate chain too long:error 22与verify_depth深度排查
linux·https·ssl证书·openssl·证书链
不像程序员的程序媛12 小时前
linux常见文本操作命令
linux·运维·服务器
wangbing112512 小时前
开发指南149-IotDB-常用命令
linux·运维·iotdb
看着博客敲代码13 小时前
WorkBuddy 接上 Kali MCP 做自动化渗透:信息收集到初步验证的落地记录
linux·人工智能·安全·网络安全·自动化
jack1868913 小时前
Devin 智能软件工程师实战应用指南
windows
小HANN14 小时前
华为云企业网站上云实战|从零搭建高可用WordPress全站架构(ECS+RDS+ELB+弹性伸缩+云监控闭环)
linux·运维·服务器·经验分享