wsl安装高版本ubuntu(24.04)

背景

本人的win10系统上,安装wsl,默认安装的ubuntu系统是20.04版本,这个版本比较老,很多软件和工具都比较老(qemu, python3), 所以决定在wsl上安装更高版本ubuntu(如24.04)。

步骤

参考以下文章:

https://blog.csdn.net/qq_46111980/article/details/153474067

这篇文章讲述了wsl安装高版本ubuntu版本的流程:先卸载wsl,再重新安装;同时讲述了如何将安装的ubuntu镜像导出到D盘,以节省C盘空间。

https://zhuanlan.zhihu.com/p/23836826798

这篇文章讲到了手动下载ubuntu的方法

https://learn.microsoft.com/en-us/windows/wsl/install-manual

官方文档,手动下载ubuntu的地址和步骤

卸载旧系统和组件

shell 复制代码
wsl -l -v # 查询当前已安装系统,显示Ubuntu

wsl --unregister Ubuntu

# 卸载系统组件(可选彻底清理)
wsl --shutdown
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart

重启电脑

shell 复制代码
shutdown /r /t 0

参考:https://blog.csdn.net/qq_46111980/article/details/153474067

启用系统组件

Open PowerShell as Administrator (Start menu > PowerShell > right-click > Run as Administrator) and enter this command

shell 复制代码
# Step 1 - Enable the Windows Subsystem for Linux
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

# Step 2 - Check requirements for running WSL 2

# Step 3 - Enable Virtual Machine feature
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

# Step 4 - Download the Linux kernel update package

Download the latest package:

Run the update package downloaded in the previous step.

shell 复制代码
# Step 5 - Set WSL 2 as your default version
wsl --set-default-version 2

参考:https://learn.microsoft.com/en-us/windows/wsl/install-manual

手动下载ubuntu版本并安装

If the Microsoft Store app is not available, you can download and manually install Linux distributions using these links:

安装下载的ubuntu版本

shell 复制代码
Add-AppxPackage .\app_name.Appx # app-name is the name of the Linux distribution .appx file.

参考:https://learn.microsoft.com/en-us/windows/wsl/install-manual

将ubuntu镜像安装到d盘

shell 复制代码
# 导出系统镜像
wsl -l -v # 显示镜像名字Ubuntu-24.04
wsl --shutdown 
wsl --export Ubuntu-24.04 D:\WSL\ubuntu24.04.tar

# 注销旧系统
wsl --unregister Ubuntu-24.04

# 导入到d盘
wsl --import Ubuntu-22.04 D:\WSL\Ubuntu D:\WSL\ubuntu24.04.tar --version 2

wsl -l -v # 显示镜像名字Ubuntu-24.04

参考:https://blog.csdn.net/qq_46111980/article/details/153474067

相关推荐
lzx_0021 天前
Linux 进程(二) 深入理解进程
linux
沫璃染墨1 天前
从零入门计算机网络系列(十二):HTTP长连接与会话管理详解——从Connection到Cookie与Session
linux·服务器·c++·tcp/ip·ubuntu·http·交互
温暖小土1 天前
在 CentOS 上安装 Redis Stack
linux·redis·centos
GeW1 天前
国产化替代进入深水区之后Linux 与数据库为什么必须走向重建
linux
longzhizhui9261 天前
Ubuntu 全版本 CVE-2026-98432 内核安全升级操作手册
ubuntu·网络安全·云计算·bash
女神下凡1 天前
芯参谋(85):Linux_PPI_NAND_驱动开发指南
linux·运维·arm开发·驱动开发·单片机·嵌入式硬件·设计规范
12.=0.1 天前
【持续更新】shell脚本 + Linux命令
linux·运维·服务器
Escalating_xu1 天前
【Linux 网络编程】五种 I/O 模型与非阻塞 I/O:从“等数据”到正确处理 EAGAIN
java·linux·网络
无言听风雨丶1 天前
Linux 容器本质探秘:Cgroup 与 Namespace 深度解析与实战
linux·运维·服务器·kubernetes