参考文章:
Ubuntu24.04更换源地址(新版源更换方式) - 陌路寒暄
一、禁用原来的软件源
Ubuntu24.04 的源地址配置文件发生改变,不再使用以前的 sources.list 文件,升级 24.04 之后,该文件内容变成了一行注释:
# Ubuntu sources have moved to /etc/apt/sources.list.d/ubuntu.sources
新的官方源配置放在了/etc/apt/sources.list.d/ubuntu.sources 中, 升级前的三方源被放在了/etc/apt/sources.list.d/third-party.sources 中。
首先修改 sources.list.d/ubuntu.sources,添加 Enabled: no 进行禁用:
二、修改 sources.list.d/third-party.sources 文件,填入国内源地址
#腾讯源
Enabled: yes
Types: deb
URIs: http://mirrors.tencent.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
#清华源
Enabled: yes
Types: deb
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
#阿里源
Enabled: yes
Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
三、更新软件源 和 升级软件包
在终端输入:
yammie@my-pc >/home/yammie
$ sudo apt-get update
yammie@my-pc >/home/yammie
$ sudo apt-get upgrade