WSL --Ubuntu-24.04-LTS子系统安装教程

bios打开虚拟化

打开Windows功能,打开"适用于Linux的Windows子系统"和"虚拟机平台"

打开powershell,输入

powershell 复制代码
wsl --install

下载完成后,在终端中输入

powershell 复制代码
wsl.exe -l -o

这条命令可以查看支持安装的linux发行版

这里用Ubuntu 24.04 LTS举例

输入

powershell 复制代码
wsl.exe --install Ubuntu-24.04

安装完成后会自动启动。注:这里的都是非桌面版

按照步骤设置用户名和密码即可

然后:

powershell 复制代码
#依次输入
cd /etc/apt
sudo vim sources.list
#注意:第二个命令需要输入的sudo密码就是前面设置过的那个
#输入
ggdG
#并且按下enter清空文本,然后黏贴以下内容,注释不建议删
powershell 复制代码
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb-src 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-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse

# 以下安全更新软件源为官方源配置
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse

最后按下esc然后输入:wq!并且按下enter即可

然后就可以使用了

关机系统就是确保子系统里没有进程了之后关掉窗口即可

打开系统的话...

在windows开始菜单的搜索栏里搜索"Ubuntu"并且打开就行...
点赞关注收藏

相关推荐
不要小看我们之间的羁绊啊12 分钟前
【windows】cc + cc switch + headroom
windows
鱼听禅22 分钟前
Ubuntu学习笔记-安装docker容器
学习·ubuntu·docker
ylscode2 小时前
CVE-2026-31694 漏洞深度分析:Linux 内核 FUSE 组件存在本地提权风险,普通用户可直取 root 权限
linux·运维·服务器
找死的豆腐2 小时前
基于.NET的Windows窗体编程之WinForms图像控件
windows·.net
XUHUOJUN2 小时前
Azure Local GPU 部署与企业应用场景指南(上篇 )
windows·microsoft·架构·nvidia·azure local
无足鸟ICT3 小时前
【RHCA+】bash命令
linux·开发语言·bash
weixin_307779133 小时前
Linux下Docker Compose里运行的MySQL数据库故障诊断Shell脚本
linux·运维·mysql·docker·自动化
小生不才yz3 小时前
Shell脚本精读 · S14-02 | 脚本模板:从 20 行工具到可维护项目
linux
x-cmd3 小时前
Linus 9 年前说「模糊测试有效」——今天已成 OSS-Fuzz 时代铁律
linux·ai·rust·开源·自动化·agent·安全性测试
六点_dn4 小时前
Linux学习笔记-chmod命令
linux·笔记·学习