Linux安装vim失败的解决办法

最近想了解一下linux编程,于是linux系统下输入vim,发现竟然没有安装。好吧,那就安装吧。命令:

sudo apt-get install vim

百度百科:apt-get是一条linux命令,适用于deb包管理式的操作系统,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。

系统报错,如下图:

网上查了下资料说是先执行update:

sudo apt-get update 

系统报错,如下:

E: Some index files failed to download, they have been ignored, or old ones used instead.
于是乎再次查找问题,发现不支持老版本ubuntu了,我的系统版本是11.10。在不安装12+以上的版本情况下,有一个解决办法,更新/etc/apt/sources.list。

sudo add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu maverick main restricted universe"

这个命令是向sources.list文件追加引号里的内容,然后执行update

发现结果中有类似http://old-releases.ubuntu.com/……的行。抱着试试看的态度,执行安装vim,成功!

小总结:
/etc/apt/sources.list 这个文件存储源信息。
deb http://cn.archive.ubuntu.com/ubuntu/ precise main restricted
这句话到底怎么解释,对应着服务器上的什么目录呢? 对应的是:
http://cn.archive.ubuntu.com/ubuntu/dists/precise/main
http://cn.archive.ubuntu.com/ubuntu/dists/precise/restricted
也就是说,解析规则是这样的 :
uri + "dists" + 版本信息 + 若干个分类

注:更新完sources.list文件后,执行update继续报错是因为该文件中有无效的目录,可以删除或者忽略。

原文地址:https://www.cnblogs.com/wonglu/p/5193168.html