服务器版本:阿里云 ubuntu 16.04
问题:
阿里云安装软件时,提示
W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/xenial/InRelea se Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/xenial-updates /InRelease Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/xenial-securit y/InRelease Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
先给出正确的解决方案,再告诉大家,我怎么分析的
cd /etc/apt/sources.list.d
cp sources-aliyun-0.list sources-aliyun-0.list.bak # 保留原版本以防改错
将 sources-aliyun-0.list 内的内容替换成以下内容
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ xenial partner
修改完毕执行
apt-get update # 更新源
到此,问题解决。
回顾解决过程
1、从百度和goole尚搜索,大多指向的是dns解析问题。
比如让我修改 dns 配置文件
vim /etc/resolvconf/resolv.conf.d/base
增加 2个dns解析
nameserver 8.8.8.8
nameserver 8.8.4.4
修改完毕后,执行命令
resolvconf -u
添加了dns 其实还是不行,原因就是,错误提示的网址根本没法访问。
知道了问题出在哪里,那我们就可以根据问题来解决
2、百度搜索 阿里云更换 apt-get 源。
搜索后,就出现了,文章开头的解决方案啦!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。