Ubuntu 24.04+ 换源 改变: /etc/apt/sources.list 采用 DEB822 格式

张开发
2026/4/6 8:46:14 15 分钟阅读

分享文章

Ubuntu 24.04+ 换源 改变: /etc/apt/sources.list 采用 DEB822 格式
Ubuntu debian源头变了我也变## TO slow ?# 1ping archive.ubuntu.comping archive.ubuntu.comPING archive.ubuntu.com (2620:2d:4000:1::103) 56 data bytes64 bytes from ubuntu-mirror-3.ps5.canonical.com (2620:2d:4000:1::103): icmp_seq1 ttl47 time343 ms64 bytes from ubuntu-mirror-3.ps5.canonical.com (2620:2d:4000:1::103): icmp_seq2 ttl47 time435 ms# 2ping mirrors.aliyun.comPING mirrors.aliyun.com.w.alikunlun.com (183.215.55.46) 56(84) bytes of data.64 bytes from 183.215.55.46: icmp_seq1 ttl47 time102 ms64 bytes from 183.215.55.46: icmp_seq2 ttl47 time63.3 ms64 bytes from 183.215.55.46: icmp_seq3 ttl47 time55.6 ms24.04在启动后的内存 1.2 GB?22.04 900MB4GB内存是无法使用 24.04 的启动几个网页就差不多了swapfile除非使用衍生版 Lubuntu ?时代变了旧硬件很难适应时代比如 Ghostty 在低端 GPU 上可能无法运行24.04 的文件管理器比 22.04 好用。Debian新一代的APT软件源配置文件格式DEB822详解 https://blog.csdn.net/luduoyuan/article/details/150356301 https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/ https://www.cnblogs.com/Thenext/p/18430885vi /etc/apt/sources.list.d/ubuntu.sources26.04 目前只在 u官方仓库才有。/etc/apt/sources.listubuntu 23.x 之前改这个文件# Ubuntu sources have moved to the /etc/apt/sources.list.d/ubuntu.sources# file, which uses the deb822 format. Use deb822-formatted .sources files# to manage package sources in the/etc/apt/sources.list.d/directory.# See the sources.list(5) manual page for details./etc/apt/sources.list.d/ubuntu.sourcesubuntu 24.04 后改这个文件apt 的语法也变了## Note, this file is written by cloud-init on first boot of an instance ## modifications made here will not survive a re-bundle. ## ## If you wish to make changes you can: ## a.) add apt_preserve_sources_list: true to /etc/cloud/cloud.cfg ## or do the same in user-data ## b.) add supplemental sources in /etc/apt/sources.list.d ## c.) make changes to template file ## /etc/cloud/templates/sources.list.ubuntu.deb822.tmpl ## # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. ## Ubuntu distribution repository ## ## The following settings can be adjusted to configure which packages to use from Ubuntu. ## Mirror your choices (except for URIs and Suites) in the security section below to ## ensure timely security updates. ## ## Types: Append deb-src to enable the fetching of source package. ## URIs: A URL to the repository (you may add multiple URLs) ## Suites: The following additional suites can be configured ## name-updates - Major bug fix updates produced after the final release of the ## distribution. ## name-backports - software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. ## Components: Aside from main, the following components can be added to the list ## restricted - Software that may not be under a free license, or protected by patents. ## universe - Community maintained packages. Software in this repository receives maintenance ## from volunteers in the Ubuntu community, or a 10 year security maintenance ## commitment from Canonical when an Ubuntu Pro subscription is attached. ## multiverse - Community maintained of restricted. Software from this repository is ## ENTIRELY UNSUPPORTED by the Ubuntu team, and may not be under a free ## licence. Please satisfy yourself as to your rights to use the software. ## Also, please note that software in multiverse WILL NOT receive any ## review or updates from the Ubuntu security team. ## ## See the sources.list(5) manual page for further settings. Types: deb URIs: http://archive.ubuntu.com/ubuntu Suites: resolute resolute-updates resolute-backports Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg ## Ubuntu security updates. Aside from URIs and Suites, ## this should mirror your choices in the previous section. Types: deb URIs: http://security.ubuntu.com/ubuntu Suites: resolute-security Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpgali 镜像 https://developer.aliyun.com/mirror/security : use aliyun serverTypes: deb URIs: https://mirrors.aliyun.com/ubuntu Suites: noble noble-updates noble-backports Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: https://mirrors.aliyun.com/ubuntu Suites: noble-security Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg------------传统格式/etc/apt/sources.listhttps://mirror.tuna.tsinghua.edu.cn/help/ubuntu/DEB822 格式/etc/apt/sources.list.d/ubuntu.sources https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/security : use ubuntu server ?Types: deb URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu Suites: noble noble-updates noble-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # 默认注释了源码镜像以提高 apt update 速度如有需要可自行取消注释 # Types: deb-src # URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu # Suites: noble noble-updates noble-backports # Components: main restricted universe multiverse # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # 以下安全更新软件源包含了官方源与镜像站配置如有需要可自行修改注释切换 Types: deb URIs: http://security.ubuntu.com/ubuntu/ Suites: noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # Types: deb-src # URIs: http://security.ubuntu.com/ubuntu/ # Suites: noble-security # Components: main restricted universe multiverse # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # 预发布软件源不建议启用 # Types: deb # URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu # Suites: noble-proposed # Components: main restricted universe multiverse # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # # Types: deb-src # # URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu # # Suites: noble-proposed # # Components: main restricted universe multiverse # # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg转载Ubuntu 24.04 换源指南使用 .sources 新格式原创 已于 2025 https://blog.csdn.net/weixin_45385956/article/details/155265778自 Ubuntu 24.04 (Noble Numbat) 起APT 的软件源配置方式发生了变化不再使用传统的 /etc/apt/sources.list 文件而是采用新的 .sources 格式文件默认路径为/etc/apt/sources.list.d/ubuntu.sources本文将指导你如何备份、修改并切换至国内镜像源如清华、中科大、阿里云等以提升软件包下载速度。一、备份原始配置在进行任何修改前请先备份原文件sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak二、编辑源配置文件使用你喜欢的编辑器如 vim打开配置文件sudo vim /etc/apt/sources.list.d/ubuntu.sources 刚安装完 Ubuntu 24.04 时默认内容通常包含官方源http://archive.ubuntu.com/ubuntu/格式为结构化的 .sources 文件。三、替换为国内镜像源✅ 推荐清华大学开源软件镜像站清华源将文件内容替换为以下配置Types: deb URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg 说明noble 是 Ubuntu 24.04 的代号。Signed-By 确保软件包来源可信无需额外导入密钥系统已内置。注释掉原来的换源后结果其他可选镜像源中国科学技术大学中科大源Types: deb URIs: http://mirrors.ustc.edu.cn/ubuntu/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg阿里云镜像源Types: deb URIs: http://mirrors.aliyun.com/ubuntu/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg网易镜像源Types: deb URIs: http://mirrors.163.com/ubuntu/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg四、ARM64如果你使用的是 ARM64 (aarch64) 架构设备请使用 ubuntu-ports 镜像Types: deb URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ Suites: noble noble-updates noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg 清华大学镜像站的 ubuntu-ports 目录最新同步时间为 2025-07-28确保软件包及时更新。五、更新软件包列表保存配置后执行以下命令刷新 APT 缓存并升级系统sudo apt update sudo apt upgrade -y若无报错且下载速度明显提升说明换源成功六、恢复默认源可选如需恢复官方源只需还原备份sudo mv /etc/apt/sources.list.d/ubuntu.sources.bak /etc/apt/sources.list.d/ubuntu.sources sudo apt update✅ 完成 你现在已成功为 Ubuntu 24.04 配置高速国内软件源。享受更快的 apt install 吧如需进一步优化如启用 deb-src 源、添加 backports 等可在此基础上扩展配置。

更多文章