移动 > 阿里

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

2人参与 2026-05-11 阿里

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

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)

您想发表意见!!点此发布评论

推荐阅读

Nginx 1.28.0 源码编译安装与自定义网页部署详细指南

05-11

Nginx try_files 指令常见用法示例

05-11

Centos7配置阿里云yum源及epel源过程

04-15

支付宝出行怎么添加到到桌面小组件? 支付宝出行创建桌面快捷方式技巧

03-17

简单操作轻松畅行! 支付宝出行设置付款方式指南

03-17

手残党也能秒会! 支付宝行乘车码领取全攻略

03-17

猜你喜欢

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

发表评论