ubuntu中无法安装vim

ubuntu中无法安装vim
 
    一般情况下,ubuntu中默认只安装了vi编辑工具,没有安装vim编辑工具。由于vim对vi进行了优化,能够主动识别Linux C语言中关键字,并用不同的颜色标记,具有很强的阅读性。那么在ubuntu中,如何安装vim工具呢?
    
    ubuntu中,通过命令“sudo apt-get install vim ”进行安装,一般情况下,都可以正常安装。成功安装vim后,在shell终端输入命令vim,可以看到有关vim相关信息,如下图所示。
图 vim详细信息
 
    有时候vim会安装失败,此时我们可以从安装失败反馈的信息中找到原因,一般vim安装失败,大都是无法获取到vim资源,所以这个时候就需要去更新源,涉及的文件为/etc/apt/sources.list文件。具体操作步骤如下:
 

1、备份sources.list文件

    sudo cp sources.list sources.list.back
 

2、替换sources.list中的内容(本人使用官方源)

    可以根据自己需求选择不同的源,将相应的源拷贝到sources.list文件中。由于权限问题,最有效的方法是在主目录下新建一个sources.list文件,将源信息拷贝到该文件中,然后通过cp命令将sources.list文件拷贝到/etc/apt/目录下。相关源的信息如下:
1)官方源
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
2)163源
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
3)阿里源
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
4)搜狐源
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
5)centos源
deb http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiverse
deb http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiverse
deb http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiverse
deb http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiverse
deb http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse
deb-src http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiverse
deb-src http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiverse
deb-src http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiverse
deb-src http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiverse
deb-src http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse
 

3、更新源

1)sudo apt-get update(更新源信息)
     
2)sudo apt-get upgrade(更新源对应的软件库信息)
 

4、安装vim

  sudo apt-get install vim
 
 
 
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值