ubuntu中国镜像_-Ubuntu 24.04-国内镜像源替换 - 替换为:
替换步骤(以阿里云镜像为例)
备份原始配置
(防止误操作):
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
修改主仓库配置
将原条目:
plaintextTypes: deb
URIs: http://cn.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
替换为:
plaintextTypes: deb
URIs: https://mirrors.aliyun.com/ubuntu/ # 改为阿里云镜像
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
修改安全源配置
将原条目:
plaintextTypes: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
替换为:
plaintextTypes: deb
URIs: https://mirrors.aliyun.com/ubuntu/ # 改为阿里云镜像
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
验证与更新
检查配置文件:
cat /etc/apt/sources.list.d/ubuntu.sources # 确认URI已替换为国内镜像
更新软件包列表:
sudo apt update # 若显示从mirrors.aliyun.com获取索引,则成功
其他国内镜像源选项
清华大学:
plaintextURIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
中科大:
plaintextURIs: https://mirrors.ustc.edu.cn/ubuntu/
华为云:
plaintextURIs: https://mirrors.huaweicloud.com/ubuntu/
注意事项
格式一致性:Ubuntu 24.04起使用DEB822格式(ubuntu.sources文件),不可替换为传统sources.list格式,否则会导致配置失效。密钥验证:Signed-By路径保持不变,国内镜像使用与官方相同的签名密钥,无需修改。网络环境:若替换后出现连接超时,可尝试切换其他镜像源(如清华或中科大)。 拼多多帮助力入口
完成替换后,软件下载速度将显著提升。如需回滚,可通过备份文件恢复原始配置。,ubuntu中国镜像