wsl安装高版本ubuntu(24.04)
2026/5/25 4:44:19 网站建设 项目流程

背景

本人的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的地址和步骤

卸载旧系统和组件

wsl-l-v# 查询当前已安装系统,显示Ubuntuwsl--unregisterUbuntu# 卸载系统组件(可选彻底清理)wsl--shutdowndism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart

重启电脑

shutdown/r /t0

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

启用系统组件

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

# Step 1 - Enable the Windows Subsystem for Linuxdism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart# Step 2 - Check requirements for running WSL 2# Step 3 - Enable Virtual Machine featuredism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart# Step 4 - Download the Linux kernel update package

Download the latest package:

  • WSL2 Linux kernel update package for x64 machines

Run the update package downloaded in the previous step.

# Step 5 - Set WSL 2 as your default versionwsl --set-default-version2

参考: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 24.04 LTS (x64, arm64)
  • Ubuntu 22.04 LTS (x64, arm64)

安装下载的ubuntu版本

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盘

# 导出系统镜像wsl-l-v# 显示镜像名字Ubuntu-24.04wsl--shutdownwsl--exportUbuntu-24.04 D:\WSL\ubuntu24.04.tar# 注销旧系统wsl--unregisterUbuntu-24.04# 导入到d盘wsl--importUbuntu-22.04 D:\WSL\Ubuntu D:\WSL\ubuntu24.04.tar--version2wsl-l-v# 显示镜像名字Ubuntu-24.04

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

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询