Ubuntu 修改软件源


#Linux#


Ubuntu 自带一套基于 apt-get 的软件管理工具,软件的下载来自特定的网站,这个网站就是软件源。

如果软件源地址不合适,会导致安装软件下载速度慢,从而耗时较长。

在 Ubuntu 中如何更改软件源?

方案1: 使用 GUI 工具

我们以 Ubuntu 18.04 桌面版为例。

步骤1

打开 Software & Updates,在 Ubuntu Software 标签页可以看到Download from的选项。

步骤2

点击选择Other,找到China,选择一个合适的软件源即可。

方案2:修改配置文件

例如,对于 ubuntu 20.04 ,若要修改成阿里云的源,将文件 /etc/apt/sources.list 备份后,内容替换成下面的即可:

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe
deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-security universe
deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse

然后执行下面的命令:

sudo apt update
sudo apt upgrade

( 本文完 )