Ubuntu全版本通用换源教程:
打开终端:按下Ctrl + Alt + T
组合键,打开终端。 备份源列表文件:在终端中执行以下命令备份原有的源列表文件:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
修改源列表文件:使用文本编辑器(例如nano或gedit)打开源列表文件:
sudo nano /etc/apt/sources.list
替换默认源:用下面提供的新源地址替换文件中的内容(根据你所在的地理位置选择一个可用的镜像源):
# 默认官方源deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse# 阿里云源deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
将 focal
替换为你使用的Ubuntu版本代号,例如 bionic
、xenial
等。
Ctrl + X
,然后按 Y
确认保存,最后按 Enter
键退出编辑器。 更新软件源:执行以下命令更新软件源列表:
sudo apt-get update
现在,你已经成功地更换了Ubuntu系统的软件源。新的源地址将提供更快的下载速度和更稳定的软件包更新。