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 multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse # 阿里云源 deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-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系统的软件源。新的源地址将提供更快的下载速度和更稳定的软件包更新。