注意事项:版本说明!!!
Ubuntu24.04的源地址配置文件发生改变。
不再使用以前的 sources.list 文件,该文件内容变成了一行注释:
# 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
24.04之前的源文件位置
/etc/apt/sources.list.d
24.04之后的源文件位置
/etc/apt/sources.list.d/ubuntu.sources
ps:以下配置我以24.04版本为例子
1. 备份原文件
在修改之前,可以选择备份原文件:
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.backup
2. 更换镜像源
sudo vim /etc/apt/sources.list.d/ubuntu.sources
- 添加清华源配置
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
- 中科大源
Types: deb
URIs: http://mirrors.ustc.edu.cn/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
- 阿里源
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
- 网易源
Types: deb
URIs: http://mirrors.163.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
ps:更换后效果的配置文件
3. 更新
sudo apt-get updatesudo apt-get upgrade -y
下载时已经切换成阿里云镜像源进行下载