ubuntu 22.04 系统更换镜像源

前言

适用于 Ubuntu 22.04 之后的操作系统

ubuntu系统默认官方源(archive.ubuntu.com)通常位于国外,国内用户访问时网络延迟高、带宽受限,导致下载软件速度很慢或者直接遇到更新失败,更换Ubuntu系统的镜像源可以告别蜗牛更新而且可以保证超强稳定性;国内常用的ubuntu镜像源主要包括阿里云、清华大学、中科大、网易等

操作步骤

  1. 查看操作系统版本,便于选择对应的源:
    lsb_release -a
  2. 备份源列表:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  3. ubuntu 22.04 LTS (jammy) 配置如下:
    deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
     
    deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
     
    deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
     
    # deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
    # deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
     
    deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
  4. ubuntu 20.04 LTS (focal) 配置如下:
    deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
     
    deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
     
    deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
     
    # deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    # deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
     
    deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  5. 执行sudo apt update 以更新软件包索引,若不执行该指令则继续使用旧源的软件包列表,无法获取新内容,该指令并不会更新系统中任何已安装的软件包:
    sudo apt update
THE END