Ubuntu 修改阿里apt源

源列表备份

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

修改源列表

进入sources.list

sudo gedit /etc/apt/sources.list 

修改源列表,把以下阿里源复制到源列表中。
一定要根据根据自己Ubuntu版本进行配置。参考阿里巴巴开源镜像站的介绍。我的版本是18.04。
ubuntu镜像-ubuntu下载地址-ubuntu安装教程-阿里巴巴开源镜像站 (aliyun.com)

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

更新源列表

sudo apt-get update

这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。

执行此命令时会报错:

GPG error: http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32


通过以下命令解决

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8

安装可以更新的软件

sudo apt-get upgrade

这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本低,就会提示更新。

你可能感兴趣的:(Ubuntu 修改阿里apt源)