ubuntu13.04一些关于安装vim的问题详解

1、问题来源

vi 1.c

能进入命令行模式,不能进入插入模式,无法编辑;

sudo apt-get install vim 提示找不到文件安装失败

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文件内容(替换前记得先备份一下cp /etc/apt/sources.list   /etc/apt/sources.list_bak;然后 sudo gedit  /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 命令,反馈信息如下所示:

ubuntu13.04一些关于安装vim的问题详解_第1张图片

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

ubuntu13.04一些关于安装vim的问题详解_第2张图片

接着就可以输入命令:sudo apt-get install vim 就可以成功地安装vim了

你可能感兴趣的:(linux)