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
相关推荐
吹什么轩1 小时前
linux系统复习:全景串联
linux·运维·服务器
m0_547486661 小时前
《Ubuntu Linux操作系统与实验教程》全套PPT课件2026
linux·ubuntu·操作系统
John_Hui2 小时前
第 1 篇:VMware 安装 Ubuntu 24.04.3 Server
linux·运维·ubuntu
kyle~2 小时前
C++ 原子操作、内存模型与无锁并发编程
linux·开发语言·c++·操作系统
2401_869769592 小时前
gdb_进程概念
linux
缘友一世2 小时前
GLM5.3 CyberSec w4A16本地部署[15]:抗退化采样与思考档
ubuntu·vllm·glm5.3 cybersec
小猪佩奇TONY2 小时前
Linux 内核学习(19) --- linux swap 机制
linux·学习·swap·kswapd
第404号工位3 小时前
浏览器的“无痕模式”是当代最大安慰剂?我用 30 行 JS 提取硬件指纹,跨网络换代理照样精准锁定你
linux·人工智能·python
心随_风动3 小时前
Ubuntu系统安装Apache服务教程
linux·ubuntu·apache
John_Hui4 小时前
第 3 篇:配置 JDK 17 环境
java·开发语言·ubuntu