Ubuntu 20.04 LTS 更换阿里源

Ubuntu 官方源在大陆访问很不稳定,因此建议更换成国内的镜像源,例如——阿里源。这里的 Ubuntu 20.04 既包含 Ubuntu Desktop,也包含 Ubuntu Server。

Linux 下万物皆是文件,源信息也是保存在文件中。

第一步:备份原文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

第二步:修改文件

sudo vim  /etc/apt/sources.list

删除原内容(可以用 VIM 的 D+数字+D 快速删除),修改为:

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

本文参考 山上小和尚 的文章,但是原文有错误:正确的文件名为 sources.list 而非 source.list 。本文代码已更改为正确信息,可放心使用。

耕读君
耕读君

云时代的我们要学会“腾云驾雾”

文章: 185

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注