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

相关推荐
zzzzzz31014 小时前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode14 小时前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
A小辣椒2 天前
TShark:Wireshark CLI 功能
linux
A小辣椒3 天前
TShark:基础知识
linux
AlfredZhao3 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao3 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334664 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪4 天前
linux 拷贝文件或目录到指定的位置
linux
摇滚侠4 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
bush44 天前
嵌入式linux学习记录十四、术语
linux·嵌入式