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