Ubuntu 24.04-国内镜像源替换

替换步骤(以阿里云镜像为例)

  • 备份原始配置
    (防止误操作):
bash 复制代码
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
  • 修改主仓库配置
    将原条目:

    plaintextTypes: deb
    URIs: http://cn.archive.ubuntu.com/ubuntu/
    Suites: noble noble-updates noble-backports
    Components: main restricted universe multiverse
    Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

替换为:

复制代码
plaintextTypes: deb
URIs: https://mirrors.aliyun.com/ubuntu/  # 改为阿里云镜像
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
  • 修改安全源配置
    将原条目:

    plaintextTypes: deb
    URIs: http://security.ubuntu.com/ubuntu/
    Suites: noble-security
    Components: main restricted universe multiverse
    Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

替换为:

复制代码
plaintextTypes: deb
URIs: https://mirrors.aliyun.com/ubuntu/  # 改为阿里云镜像
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

验证与更新

  • 检查配置文件:
bash 复制代码
cat /etc/apt/sources.list.d/ubuntu.sources  # 确认URI已替换为国内镜像
  • 更新软件包列表:
bash 复制代码
sudo apt update  # 若显示从mirrors.aliyun.com获取索引,则成功

其他国内镜像源选项

注意事项

  • 格式一致性:Ubuntu 24.04起使用DEB822格式(ubuntu.sources文件),不可替换为传统sources.list格式,否则会导致配置失效。
  • 密钥验证:Signed-By路径保持不变,国内镜像使用与官方相同的签名密钥,无需修改。
  • 网络环境:若替换后出现连接超时,可尝试切换其他镜像源(如清华或中科大)。
    完成替换后,软件下载速度将显著提升。如需回滚,可通过备份文件恢复原始配置。
相关推荐
米高梅狮子1 天前
03.网络类服务实践
linux·运维·服务器·网络·kubernetes·centos·openstack
June`1 天前
网络编程时内核究竟做了什么???
linux·服务器·网络
楼兰公子1 天前
RK3588 + Linux7.0.3 网络工程调试错误速查手册
linux·网络·3588
Elnaij1 天前
Linux系统与系统编程(9)——自设计shell与基础IO
linux·服务器
IMPYLH1 天前
Linux 的 unexpand 命令
linux·运维·服务器·bash
|_⊙1 天前
Linux 文件知识 补充
linux·运维·服务器
落羽的落羽1 天前
【算法札记】练习 | Week4
linux·服务器·数据结构·c++·人工智能·算法·动态规划
Mortalbreeze1 天前
深度理解文件系统 ---- 从磁盘存储到内核存储
大数据·linux·数据库
LN花开富贵1 天前
Ubuntu aarch64 架构安装 NoMachine 远程控制 避坑与实战
linux·运维·笔记·学习·ubuntu·嵌入式
取经蜗牛1 天前
Windows 11 WSL + Ubuntu 24.04 安装指南
linux·windows·ubuntu