当前位置: 代码网 > 移动>阿里 > Ubuntu26.04换阿里云镜像源过程

Ubuntu26.04换阿里云镜像源过程

2026年05月11日 阿里 我要评论
先备份原始源,再替换为阿里云源即可。ubuntu 26.04(resolute raccoon)默认已经使用 .sources 格式,而不是老的 sources.list。1. 备份原配置sudo c

先备份原始源,再替换为阿里云源即可。

ubuntu 26.04(resolute raccoon)默认已经使用 .sources 格式,而不是老的 sources.list

1. 备份原配置

sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak

2. 编辑镜像源

sudo vim /etc/apt/sources.list.d/ubuntu.sources

将内容替换为:

types: deb
uris: https://mirrors.aliyun.com/ubuntu/
suites: resolute resolute-updates resolute-backports
components: main restricted universe multiverse
signed-by: /usr/share/keyrings/ubuntu-archive-keyring.gpg

types: deb
uris: https://mirrors.aliyun.com/ubuntu/
suites: resolute-security
components: main restricted universe multiverse
signed-by: /usr/share/keyrings/ubuntu-archive-keyring.gpg

3. 更新缓存

sudo apt update

4. 验证是否生效

apt policy

或者:

grep -e "mirrors.aliyun.com" /etc/apt/sources.list.d/ubuntu.sources

一键脚本(推荐)

直接执行:

sudo bash -c 'cat > /etc/apt/sources.list.d/ubuntu.sources <<eof
types: deb
uris: https://mirrors.aliyun.com/ubuntu/
suites: resolute resolute-updates resolute-backports
components: main restricted universe multiverse
signed-by: /usr/share/keyrings/ubuntu-archive-keyring.gpg

types: deb
uris: https://mirrors.aliyun.com/ubuntu/
suites: resolute-security
components: main restricted universe multiverse
signed-by: /usr/share/keyrings/ubuntu-archive-keyring.gpg
eof'

sudo apt update

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2026  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com