Ubuntu apt-get install 问题: Could not resolve 'cn.archive.ubuntu.com'

问题描述:

今天使用Ubuntu 安装Ctags 时,遇见以下问题:

sudo apt-get install ctags

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'exuberant-ctags' instead of 'ctags'
The following NEW packages will be installed:
  exuberant-ctags
0 upgraded, 1 newly installed, 0 to remove and 356 not upgraded.
Need to get 133 kB of archives.
After this operation, 308 kB of additional disk space will be used.
Err http://cn.archive.ubuntu.com/ubuntu/ saucy/main exuberant-ctags i386 1:5.9~svn20110310-6
  Could not resolve 'cn.archive.ubuntu.com'
Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/e/exuberant-ctags/exuberant-ctags_5.9~svn20110310-6_i386.deb  Could not resolve 'cn.archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

解决方法:

从Error Message 上看来似乎是“cn.archive.ubuntu.com”域名解析出错。于是在Terminal 里Ping了一下这个域名,发现可以Ping 通。

ping cn.archive.ubuntu.com

PING mirror.neu.edu.cn (202.118.1.64) 56(84) bytes of data.
64 bytes from ftp2.neu.edu.cn (202.118.1.64): icmp_seq=1 ttl=45 time=86.3 ms
64 bytes from ftp2.neu.edu.cn (202.118.1.64): icmp_seq=2 ttl=45 time=100 ms
64 bytes from ftp2.neu.edu.cn (202.118.1.64): icmp_seq=3 ttl=45 time=86.8 ms

于是尝试通过修改 /etc/hosts 解决这个问题:

  1. vi /etc/hosts
  2. 在文件末尾加入 “202.118.1.64 cn.archive.ubuntu.com”。
  3. 运行 “#/etc/init.d/networking restart” 重启网络。
  4. 运行 “sudo apt-get install ctags” 重新安装Ctags,成功!!!
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值