虚拟机下ubuntu13.04一些关于安装vim的问题详解


1、问题来源

今天闲来无事,想尝试下linux环境下的python开发,于是在win7上安装了VMware 11.0,然后在虚拟机上安装了ubuntu13.04。要进行python编码,于是选择一款好的编辑工具尤为重,而且一直听说vim是一款不错的编辑器,所以我了准备选择vim来作为我的python编码工具。于是我输入命令vim:效果如下图所示:

\

看来ubuntu13.04本身自带了vi,而没有vim,于是乎便准备自己下载vim工具;那么所以然后问题就来了,,,当我敲下命令 sudo apt-get install vim时,给我的反馈居然是:<喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+PGltZyBzcmM9"http://www.2cto.com/uploadfile/Collfiles/20150131/2015013109413869.jpg" alt="\">

2、解决方案

针对反馈信息,便开始百度查找原因,总结查找资料,主要有两种方案:

方案一

1、首先输入命令sudo apt-get update

2、然后输入命令sudo apt-get install vim

当我输入sudo apt-get update命令时,得到的反馈信息如下所示:

Ign http://security.ubuntu.com raring-security Release.gpg
Ign http://security.ubuntu.com raring-security Release
Ign http://us.archive.ubuntu.com raring Release.gpg
Ign http://extras.ubuntu.com raring Release.gpg
Ign http://us.archive.ubuntu.com raring-updates Release.gpg
Ign http://extras.ubuntu.com raring Release
Ign http://us.archive.ubuntu.com raring-backports Release.gpg
Ign http://us.archive.ubuntu.com raring Release
Ign http://us.archive.ubuntu.com raring-updates Release
Ign http://us.archive.ubuntu.com raring-backports Release
Err http://extras.ubuntu.com raring/main Sources
404 Not Found
Err http://extras.ubuntu.com raring/main i386 Packages
404 Not Found
Ign http://extras.ubuntu.com raring/main Translation-en_US
Ign http://extras.ubuntu.com raring/main Translation-en
Err http://security.ubuntu.com raring-security/main Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/restricted Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/universe Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/multiverse Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/main i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/restricted i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/universe i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://security.ubuntu.com raring-security/multiverse i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Ign http://security.ubuntu.com raring-security/main Translation-en_US
Ign http://security.ubuntu.com raring-security/main Translation-en
Ign http://security.ubuntu.com raring-security/multiverse Translation-en_US
Ign http://security.ubuntu.com raring-security/multiverse Translation-en
Ign http://security.ubuntu.com raring-security/restricted Translation-en_US
Ign http://security.ubuntu.com raring-security/restricted Translation-en
Ign http://security.ubuntu.com raring-security/universe Translation-en_US
Ign http://security.ubuntu.com raring-security/universe Translation-en
Err http://us.archive.ubuntu.com raring/main Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/restricted Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/universe Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/multiverse Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/main i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/restricted i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/universe i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring/multiverse i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Ign http://us.archive.ubuntu.com raring/main Translation-en_US
Ign http://us.archive.ubuntu.com raring/main Translation-en
Ign http://us.archive.ubuntu.com raring/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com raring/multiverse Translation-en
Ign http://us.archive.ubuntu.com raring/restricted Translation-en_US
Ign http://us.archive.ubuntu.com raring/restricted Translation-en
Ign http://us.archive.ubuntu.com raring/universe Translation-en_US
Ign http://us.archive.ubuntu.com raring/universe Translation-en
Err http://us.archive.ubuntu.com raring-updates/main Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/restricted Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/universe Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/multiverse Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/main i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/restricted i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/universe i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-updates/multiverse i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Ign http://us.archive.ubuntu.com raring-updates/main Translation-en_US
Ign http://us.archive.ubuntu.com raring-updates/main Translation-en
Ign http://us.archive.ubuntu.com raring-updates/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com raring-updates/multiverse Translation-en
Ign http://us.archive.ubuntu.com raring-updates/restricted Translation-en_US
Ign http://us.archive.ubuntu.com raring-updates/restricted Translation-en
Ign http://us.archive.ubuntu.com raring-updates/universe Translation-en_US
Ign http://us.archive.ubuntu.com raring-updates/universe Translation-en
Err http://us.archive.ubuntu.com raring-backports/main Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/restricted Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/universe Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/multiverse Sources
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/main i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/restricted i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/universe i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com raring-backports/multiverse i386 Packages
404 Not Found [IP: 91.189.91.13 80]
Ign http://us.archive.ubuntu.com raring-backports/main Translation-en_US
Ign http://us.archive.ubuntu.com raring-backports/main Translation-en
Ign http://us.archive.ubuntu.com raring-backports/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com raring-backports/multiverse Translation-en
Ign http://us.archive.ubuntu.com raring-backports/restricted Translation-en_US
Ign http://us.archive.ubuntu.com raring-backports/restricted Translation-en
Ign http://us.archive.ubuntu.com raring-backports/universe Translation-en_US
Ign http://us.archive.ubuntu.com raring-backports/universe Translation-en
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/restricted/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/multiverse/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/source/Sources 404 Not Found


W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/main/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/restricted/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/universe/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/multiverse/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/main/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/restricted/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/universe/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/multiverse/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-updates/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/main/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/restricted/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/universe/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/multiverse/source/Sources 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]


E: Some index files failed to download. They have been ignored, or old ones used instead.

于是这种方案没能解决我的问题,于是只能采用方案二。

方案二:

在方案一中,仅仅输入sudo apt-get update,更新 源(/etc/apt/source.list文件)也不一定能解决问题,因为这些源可能不包含vim安装包,所以方案二的主要思想是换 源,即替换/etc/apt/sources.list文件内容,于是我网上查找ubuntu13.04的 源,试过了好多源,依然出现类似上述红色字体的错误,直到用如下这个源,情况才有所改善,该源是ubuntu10.04的源:

# deb cdrom:[Ubuntu 10.04.3 LTS _Lucid Lynx_ - Release amd64 (20110720.1)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ lucid main restricted

## Major bug fix updates produced after the final release of the
## distribution.

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ lucid universe
deb-src http://cn.archive.ubuntu.com/ubuntu/ lucid universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ lucid multiverse

## Uncomment the following two lines to add software from the "backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://cn.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse


## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu lucid partner
# deb-src http://archive.canonical.com/ubuntu lucid partner


deb http://archive.canonical.com/ lucid partner
deb-src http://archive.canonical.com/ lucid partner
deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner
deb http://archive.canonical.com/ lucid partner
deb http://security.ubuntu.com/ubuntu/ lucid-security restricted main multiverse universer

替换掉原有的的源后,输入命令:sudo apt-get update 反馈信息如下图所示:

Get:1 http://cn.archive.ubuntu.com lucid Release.gpg [189 B]
Get:2 http://cn.archive.ubuntu.com lucid Release [57.2 kB]
Get:3 http://cn.archive.ubuntu.com lucid/main Sources [659 kB]
Get:4 http://security.ubuntu.com lucid-security Release.gpg [198 B]
Get:5 http://security.ubuntu.com lucid-security Release [57.3 kB]
Hit http://archive.canonical.com lucid Release.gpg
Get:6 http://archive.canonical.com lucid Release.gpg [198 B]
Hit http://archive.canonical.com lucid Release
Get:7 http://archive.canonical.com lucid Release [8,215 B]
Get:8 http://archive.canonical.com lucid/partner Sources [8,247 B]
Get:9 http://security.ubuntu.com lucid-security/restricted i386 Packages [2,881 B]
Hit http://archive.canonical.com lucid/partner i386 Packages
Get:10 http://cn.archive.ubuntu.com lucid/restricted Sources [3,775 B]
Get:11 http://archive.canonical.com lucid/partner Sources [8,247 B]
Get:12 http://cn.archive.ubuntu.com lucid/universe Sources [3,165 kB]
Get:13 http://security.ubuntu.com lucid-security/main i386 Packages [612 kB]
Get:14 http://archive.canonical.com lucid/partner i386 Packages [14.6 kB]
Ign http://archive.canonical.com lucid/partner Translation-en_US
Ign http://archive.canonical.com lucid/partner Translation-en
Ign http://archive.canonical.com lucid/partner Translation-en_US
Ign http://archive.canonical.com lucid/partner Translation-en
Get:15 http://cn.archive.ubuntu.com lucid/multiverse Sources [119 kB]
Get:16 http://cn.archive.ubuntu.com lucid/main i386 Packages [1,386 kB]
Get:17 http://security.ubuntu.com lucid-security/multiverse i386 Packages [5,382 B]
Get:18 http://cn.archive.ubuntu.com lucid/restricted i386 Packages [6,208 B]
Get:19 http://cn.archive.ubuntu.com lucid/universe i386 Packages [5,448 kB]
Get:20 http://cn.archive.ubuntu.com lucid/multiverse i386 Packages [180 kB]
Ign http://cn.archive.ubuntu.com lucid/main Translation-en_US
Ign http://cn.archive.ubuntu.com lucid/main Translation-en
Ign http://cn.archive.ubuntu.com lucid/multiverse Translation-en_US
Ign http://cn.archive.ubuntu.com lucid/multiverse Translation-en
Ign http://cn.archive.ubuntu.com lucid/restricted Translation-en_US
Ign http://cn.archive.ubuntu.com lucid/restricted Translation-en
Ign http://cn.archive.ubuntu.com lucid/universe Translation-en_US
Ign http://cn.archive.ubuntu.com lucid/universe Translation-en
Fetched 11.7 MB in 1min 42s (115 kB/s)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/lucid-security/Release Unable to find expected entry 'universer/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)


E: Some index files failed to download. They have been ignored, or old ones used instead.

然后,我输入 sudo apt-get install vim 命令,反馈信息如下所示:

\

针对这个问题,解决方案是输入命令:sudo apt-get purge vim-common,命令执行后效果如图所示:

\

接着就可以输入命令:sudo apt-get install vim 就可以成功地安装vim了(由于安装需要下载相关资源,所以安装过程需要一段时间,我大概花了十分钟左右)

为庆祝终于解决了这个问题,最后附上一张vim打开效果图:


相关内容