Ubuntu 16.04 更新源失败问题

在输入sudo apt-get update出现暂时不能解析域名“us.archive.ubuntu.com”折腾了一周,终于解决了
解决办法:有用的点个赞 
先要吧源备份一个哦:
sudo cp /etc/apt/sources.list.d/ubuntukylin.list /etc/apt/sources.list.d/ubuntukylin.list.bak
1
接下来:
sudo vim /etc/apt/sources.list.d/ubuntukylin.list
1
第一步打开文件后将文件
原来的:deb http://archive.ubuntukylin.com:10006/ubuntukylin trusty main
修改的:deb http://archive.ubuntukylin.com:10006/ubuntukylin xenial main
1
2
最近一直有朋友加我 问我这个问题 说看我的这样弄了以后还是不好用 
因为我这边缺少了源的添加:
添加新的源文件:
sudo vi /etc/apt/sources.list
1
并添加以下内容:注意,每一行的trusty应该用第一步查看得到的Codename来代替
deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe 
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
以下提供配置 
1Codename=$( (lsb_release -a)|awk ‘{print $2}‘|tail -n 1 ) 
2echo "\ 
3deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe 
4deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe 
5deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe 
6deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe 
7deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe 
8deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe 
9deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe 
10deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe 
11deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe 
12deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe ">sources.list 
13apt-get update 
sudo运行该脚本即可(注意运行之前最好备份之前的sources.list)
第二步这一步干完了还不够 接下来配置dns
sudo vi /etc/resolv.conf
1
打开后添加
#阿里的dns  因为我用的是阿里的源哦 这里要根据你使用的源修改
nameserver 223.5.5.5  
1
2
第三步接下来 重启网络服务
/etc/init.d/networking restart 
1
这样就好了接下来先更新吧
sudo apt-get update
sudo apt-get upgrade
1
2
执行我完成后问题又来了 请看:
更新后出现:
AppStream cache update completed, but some metadata was ignored due to errors.
正在读取软件包列表... 完成
W: GPG 错误:http://archive.ubuntukylin.com:10006/ubuntukylin xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY 8D5A09DC9B929006
W: 仓库 “http://archive.ubuntukylin.com:10006/ubuntukylin xenial InRelease” 没有数字签名。
N: 无法认证来自该源的数据,所以使用它会带来潜在风险。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
W: 以下 ID 的密钥没有可用的公钥:
8D5A09DC9B929006  
--------------------- 
作者:庞成勇博客 
来源:CSDN 
原文:https://blog.csdn.net/pangchengyong0724/article/details/52452878 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/qq_28090573/article/details/83183441
今日推荐