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

相关推荐
嵌入式阿蔡14 小时前
Linux_01:交叉编译与开发环境实战——从单片机跨到 Linux 的第一道坎
linux·运维·网络·单片机·嵌入式硬件·嵌入式实时数据库
Pocker_Spades_A14 小时前
终端里也能斗地主:Linux部署Ratel,从本地对战到公网联机
linux·运维·服务器
佳児素花痴╮14 小时前
C语言链接库
linux·运维·服务器
Cerman15 小时前
QEMU启动OVMF shell超时分析
c语言·windows·经验分享
wWYy.15 小时前
Linux发送数据包的过程
linux·网络
小嵌同学15 小时前
Linux 内核中的 Per-CPU 机制详解
linux·运维·arm开发·嵌入式
Hello-FPGA16 小时前
嵌入式LINUX 设备 ip配置后怎么保存才能掉电不消失?
linux·运维·服务器
工业一体机老司机17 小时前
Linux工业一体机自启动服务配置:systemd服务单元编写与开机优化实战
java·linux·服务器
zhixingheyi_tian17 小时前
Linux 之 ssh
linux·服务器·ssh
小鱼仙官17 小时前
Ubuntu C++ NTP校时程序
linux·c++·ubuntu