更换方法
Ubuntu采用apt作为软件安装工具,其镜像源列表记录在/etc/apt/source.list文件中。
首先将source.list复制为source.list.bak备份,然后将source.list内容改为需要的镜像源列表即可。
修改完成后保存source.list文件,执行:
sudo apt update
等待更新完成即可。
常用国内镜像源
本节均为 Ubuntu 20.04 的镜像源列表。若为其他版本,将所有focal更改为其他版本代号即可。
常用的Ubuntu版本代号如下:
Ubuntu 22.04:jammy
Ubuntu 20.04:focal
Ubuntu 18.04:bionic
Ubuntu 16.04:xenial
Ubuntu 通常采用“形容词+小动物”作为版本代号(默认的壁纸),在镜像源列表中只有第一个词。
此外,默认注释了代码源以提高速度,注释了预发布软件源(可能不稳定)。如有需要可以取消注释。
建议将所有常用镜像源保存在/etc/apt目录下,并命名为类似source.list.aliyun的形式,需要使用时直接复制替换source.list文件即可。
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse# deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse## Pre-released source, not recommended.
# deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse## Pre-released source, not recommended.
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse## Pre-released source, not recommended.
# deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse# deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse## Pre-released source, not recommended.
# deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
最后更新即可。
sudo apt-get update
二、简单操作方法
打开软件和更新,选择下载自:
选择阿里云,或者选择最佳服务器。
然后关闭后会自动更新包