Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Could not resolve ‘security.ubun

在执行apt-get update命令的时候更新报错。

Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Could not resolve 'security.ubuntu.com'
Err:2 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
  Could not resolve 'cn.archive.ubuntu.com'
Err:3 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
  Could not resolve 'cn.archive.ubuntu.com'
Err:4 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
  Could not resolve 'cn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'cn.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
root@mec-PowerEdge-T40:~# vi /etc/resolv.conf 
root@mec-PowerEdge-T40:~# apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]        
Get:4 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]       
Get:5 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [48.9 kB]
Get:6 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [1,133 kB]     
Get:7 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [57.1 kB]
Get:8 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1,713 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]  
Get:10 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [364 kB]
Get:11 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [295 kB]
Get:12 http://cn.archive.ubuntu.com/ubuntu bionic-updates/restricted i386 Packages [17.3 kB]
Get:13 http://cn.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [178 kB]
Get:14 http://cn.archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [24.0 kB]
Get:15 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [1,542 kB]
Get:16 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,678 kB]
Get:17 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [353 kB]
Get:18 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [286 kB]
Get:19 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [214 kB]
Get:20 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [463 kB]
Get:21 http://cn.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [31.7 kB]
Get:22 http://cn.archive.ubuntu.com/ubuntu bionic-updates/multiverse i386 Packages [13.0 kB]
Get:23 http://cn.archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [6,952 B]
Get:24 http://cn.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:25 http://cn.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [9,288 B]
Fetched 8,683 kB in 4s (2,234 kB/s)                                   
Reading package lists... Done

解决办法:

修改DNS,编辑resolv.conf文件:原来的nameserver注释掉,加入下面2行即可

# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

更新成功!!

 

  • 13
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 19
    评论
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

软件测试李同学

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值