必须先确认系统代号再修改sources.list,否则sudo apt update会报404错误;2026年主流为noble(24.04),需使用对应代号的阿里云等国内镜像源,注意https协议、正确空格与路径格式,并执行sudo apt update刷新缓存。

确认系统代号再动手
直接改 sources.list 却不匹配系统代号,sudo apt update 会报一堆 404 Not Found 错误。先查清楚你用的是哪个版本:运行 lsb_release -sc,输出像 focal(20.04)、jammy(22.04)或 noble(24.04)——2026 年主流是 noble,别套用老教程里的 focal。
命令行替换镜像源最稳妥
图形界面点“选择最佳服务器”看似省事,但实际常选到响应慢、同步滞后的节点,尤其在非工作时间。手动编辑更可控:
- 先备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak - 用
nano编辑:sudo nano /etc/apt/sources.list - 清空原内容,粘贴对应代号的阿里云源(以
noble为例):
deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
注意全部用 https,别漏掉 -src 行;清华源地址是 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/,中科大是 https://mirrors.ustc.edu.cn/ubuntu/,协议和路径结构一致。
Ubuntu 26.04 LTS(代号“Resolute Raccoon”)是Canonical于2026年4月23日发布的下一代长期支持版操作系统,提供长达10年的技术支持。它搭载Linux 7.0内核与GNOME 50桌面环境,全面转向Wayland协议,并引入Rust重写的核心工具以增强安全性。官方提供适用于AMD64和ARM64架构的桌面及服务器ISO镜像,是追求前沿技术与极致稳定的开发者
更新前必须检查 URL 格式
常见翻车点不是镜像站本身,而是手误导致的格式错误:
- 每行开头必须是
deb或deb-src,不能多空格、不能少空格 - 镜像地址末尾不加斜杠(
.../ubuntu/noble✅,.../ubuntu/noble/❌) - 代号后紧跟空格,再跟组件名(
noble main✅,noble-main❌) - 别混用
http和https——阿里云、清华、中科大目前都强制https,用http会连接失败
更新失败时优先看网络与证书
sudo apt update 报错不是源写错了,大概率是 TLS 握手问题:
- 如果提示
Could not resolve 'mirrors.aliyun.com',先ping -c 3 mirrors.aliyun.com看 DNS 是否通 - 如果提示
server certificate verification failed,说明系统时间偏差大或 CA 证书过期,运行sudo apt install -y ca-certificates再试 - 极少数情况是镜像站临时同步中断(比如凌晨 2–4 点),换清华或中科大源重试即可,不用怀疑配置
真正容易被忽略的是:改完 sources.list 后,apt 不会自动刷新缓存,必须手动跑 sudo apt update;而很多人卡在没执行这步,就去重装软件,结果还是走旧源。

















