安装 wsl-ubuntu 24.04

engchina 2024-07-13 08:07:03 阅读 70

安装 wsl-ubuntu 24.04

1. 安装 Ubuntu-24.042. (可选)配置阿里云软件源3. 系统更新

1. 安装 Ubuntu-24.04

安装 Ubuntu-24.04,默认会安装在 C 盘,

<code>wsl --install -d Ubuntu-24.04

导出 Ubuntu-24.04,

wsl --export Ubuntu-24.04 D:\tmp\Ubuntu-24.04.tar

删除 Ubuntu-24.04,

wsl --unregister Ubuntu-24.04

导入 Ubuntu-24.04,导入到 F:\VirtualPCs\Ubuntu-24.04 目录,

wsl --import Ubuntu-24.04 F:\VirtualPCs\Ubuntu-24.04 D:\tmp\Ubuntu-24.04.tar

访问 Ubuntu-24.04,

wsl

退出 Ubuntu-24.04,

exit

(可选)关闭 Ubuntu-24.04,

wsl --shutdown -d Ubuntu-24.04

2. (可选)配置阿里云软件源

20240427时点,清华大学还不支持24.04 LTS:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/

为了加速软件安装速度,配置阿里云软件源,

mv /etc/apt/sources.list /etc/apt/sources.list.bak

cat << EOF > /etc/apt/sources.list

deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse

# deb-src https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse

EOF

refer: https://developer.aliyun.com/mirror/ubunt

3. 系统更新

sudo apt update && sudo apt upgrade

完结!



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。