Ubuntu更换源

腾讯云的Ubuntu使用apt安装软件会报找不到源

Err:1 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1
Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
Ign:2 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 autoconf all 2.69-11
Ign:3 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1
Ign:4 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2
Err:2 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 autoconf all 2.69-11
Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
Err:3 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1
Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
Err:4 http://mirrors.tencentyun.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2
Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://mirrors.tencentyun.com/ubuntu/pool/main/m/m4/m4_1.4.18-1_amd64.deb Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://mirrors.tencentyun.com/ubuntu/pool/main/a/autoconf/autoconf_2.69-11_all.deb Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://mirrors.tencentyun.com/ubuntu/pool/main/a/autotools-dev/autotools-dev_20180224.1_all.deb Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://mirrors.tencentyun.com/ubuntu/pool/main/a/automake-1.15/automake_1.15.1-3ubuntu2_all.deb Something wicked happened resolving 'mirrors.tencentyun.com:http' (-5 - No address associated with hostname)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

看着应该是mirrors.tencentyun.com挂了,都ping不通,更换源就好了:

0.1. 首先备份源列表

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

0.2. 修改sources.list文件

sudo vi /etc/apt/sources.list

0.3. 编辑/etc/apt/sources.list文件, 在文件最前面添加阿里云镜像源

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

0.4. 刷新列表

sudo apt-get update
sudo apt-get upgrade