问题描述:
今天使用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 解决这个问题:
- vi /etc/hosts
- 在文件末尾加入 “202.118.1.64 cn.archive.ubuntu.com”。
- 运行 “#/etc/init.d/networking restart” 重启网络。
- 运行 “sudo apt-get install ctags” 重新安装Ctags,成功!!!