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

来源:互联网 发布:软件开发教程 编辑:程序博客网 时间:2024/04/27 23:54

问题描述:

今天使用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,成功!!!
0 0
原创粉丝点击