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"并且打开就行...
点赞关注收藏

相关推荐
似的8351 天前
一步一步学习使用FireMonkey动画() 使用TAnimator类创建动画
linux·学习·nginx
我不管我就要叫小猪1 天前
嵌入式Linux----网络通信
linux·运维·服务器
泡沫冰@1 天前
ECS 的介绍和使用
linux·服务器·网络
笨鸟先飞,勤能补拙1 天前
AI 赋能网络安全领域深度剖析
网络·人工智能·windows·安全·web安全·网络安全·github
姜太小白1 天前
【Linux】df -h 卡住问题的通用排查与解决方案总结
linux·运维·php
fengyehongWorld1 天前
Linux 终端快捷键
linux·运维
我上去就是一套QWER然后等待复活1 天前
Windows 清理 CC Switch 并恢复官方 Codex CLI 登录流程(完整记录)
windows
吾儿良辰1 天前
一个被BCL遗忘的高性能集合:C# CircularBuffer<T>深度解析
开发语言·windows·c#
哎呦喂我去去去1 天前
C#实现屏幕墙:同时监控多个电脑桌面(支持Windows、信创Linux、银河麒麟、统信UOS)
linux·windows·c#
easy_coder1 天前
Linux LVM 知识文档
linux·运维