如何更换Ubuntu系统软件源
简介
新安装的
Ubuntu
系统,系统自带的默认软件源在国内安装软件时会很缓慢,甚至无法访问。所以本文简单介绍如何把软件源更换为国内镜像源,以加快访问速度。
方法一: 使用软件源管理工具
新版本的Ubuntu
系统(包括Ubuntu
系的其他系统),默认内置了软件源管理工具,可以直接使用工具切换软件源,本文以ZorinOS
为例。
打开 软件和更新
GUI 界面,选择下载自
下拉框(如下图),选择其他站点
,然后选中中国境内的镜像源地址(如mirrors.ustc.edu.cn
)。
点击右下角选择服务器
按钮(如下图),然后点击关闭
按钮。
系统将提示可用软件信息已过时
(如下图),点击重新载入
按钮,少待片刻即可完成换源。
方法二: 手动修改配置文件
于终端执行以下命令
# 先备份下默认软件源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
# 编辑软件源配置文件
sudo gedit /etc/apt/sources.list
粘贴以下内容覆盖至配置文件
注:也可以使用其他源 (点击展开)
#网易源
deb <http://mirrors.163.com/ubuntu/> focal main restricted universe multiverse
deb <http://mirrors.163.com/ubuntu/> focal-security main restricted universe multiverse
deb <http://mirrors.163.com/ubuntu/> focal-updates main restricted universe multiverse
deb <http://mirrors.163.com/ubuntu/> focal-backports main restricted universe multiverse
# deb-src <http://mirrors.163.com/ubuntu/> focal main restricted universe multiverse
# deb-src <http://mirrors.163.com/ubuntu/> focal-security main restricted universe multiverse
# deb-src <http://mirrors.163.com/ubuntu/> focal-updates main restricted universe multiverse
# deb-src <http://mirrors.163.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-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-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-proposed main restricted universe multiverse
#deb-src <http://mirrors.aliyun.com/ubuntu/> focal-proposed 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
#清华源
deb <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal main restricted universe multiverse
# deb-src <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal main restricted universe multiverse
deb <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal-updates main restricted universe multiverse
# deb-src <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal-updates main restricted universe multiverse
deb <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal-backports main restricted universe multiverse
# deb-src <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal-backports main restricted universe multiverse
deb <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal-security main restricted universe multiverse
# deb-src <https://mirrors.tuna.tsinghua.edu.cn/ubuntu/> focal-security main restricted universe multiverse
#中科大源
deb <https://mirrors.ustc.edu.cn/ubuntu/> focal main restricted universe multiverse
#deb-src <https://mirrors.ustc.edu.cn/ubuntu/> focal main restricted universe multiverse
deb <https://mirrors.ustc.edu.cn/ubuntu/> focal-updates main restricted universe multiverse
#deb-src <https://mirrors.ustc.edu.cn/ubuntu/> focal-updates main restricted universe multiverse
deb <https://mirrors.ustc.edu.cn/ubuntu/> focal-backports main restricted universe multiverse
#deb-src <https://mirrors.ustc.edu.cn/ubuntu/> focal-backports main restricted universe multiverse
deb <https://mirrors.ustc.edu.cn/ubuntu/> focal-security main restricted universe multiverse
#deb-src <https://mirrors.ustc.edu.cn/ubuntu/> focal-security main restricted universe multiverse
deb <https://mirrors.ustc.edu.cn/ubuntu/> focal-proposed main restricted universe multiverse
#deb-src <https://mirrors.ustc.edu.cn/ubuntu/> focal-proposed main restricted universe multiverse
保存文件,于终端执行以下命令
sudo apt update
sudo apt upgrade