Ubuntu 26.04 换阿里云镜像源

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

Ubuntu 26.04(Resolute Raccoon)默认已经使用 .sources 格式,而不是老的 sources.list

1. 备份原配置

bash 复制代码
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak

2. 编辑镜像源

bash 复制代码
sudo vim /etc/apt/sources.list.d/ubuntu.sources

将内容替换为:

yaml 复制代码
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. 更新缓存

bash 复制代码
sudo apt update

4. 验证是否生效

bash 复制代码
apt policy

或者:

bash 复制代码
grep -E "mirrors.aliyun.com" /etc/apt/sources.list.d/ubuntu.sources

一键脚本(推荐)

直接执行:

bash 复制代码
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
相关推荐
携程DBA3 分钟前
数据库软限制相关研究
linux·mysql·性能
huy1n95 分钟前
Ubuntu 22.04部署Claude Code并接入DeepSeek-V4模型完整教程
linux·ubuntu·deepseek·claude code
ICECREAM1 小时前
I/O 多路复用完全指南 —— select、poll、epoll
linux
进阶的猪1 小时前
Linux 内核移植过程学习
linux·学习
Database_Cool_3 小时前
内存数据库持久化方案:阿里云 Tair 持久内存型数据不丢失
数据库·阿里云
问简3 小时前
【共享盘】ubuntu、windows
linux·windows·ubuntu
小生不才yz4 小时前
Shell脚本精读 · S13-01 | POSIX sh 与 Bash:语法对照表
linux
阿拉斯攀登4 小时前
平台设备驱动:platform bus 与设备树
linux·嵌入式硬件·嵌入式·linux驱动·字符设备驱动
阿拉斯攀登4 小时前
并发与同步:自旋锁、信号量、互斥锁
linux·网络·嵌入式硬件·linux驱动·字符设备驱动