用centos 的主机的時候, 用 vim 时出现 -bash: vim: command not found. 只能使用 vi. 那么如何安裝 vim 呢?
输入 rpm -qa|grep vim 命令, 如果 vim 已经正确安装,会返回下面的三行代码: [root@centos]# rpm -qa |grep vim vim-minimal-7.0.109-6.el5 vim-common-7.0.109-7.2.el5 vim-enhanced-7.0.109-7.2.el5 如果少了其中的某一条,比如 vim-enhanced 的,就用命令 yum -y install vim-enhanced 来安装: yum -y install vim-enhanced 如果上面的三条都沒有返回, 可以直接用 yum -y install vim* 命令 yum -y install vim*
二。
[root@localhost ~]# ll
#部分省略了......
-rwxr--r-- 1 root root
#用vim打开test.txt文件
[root@localhost ~]# vim test.txt
-bash: vim: command not found
[root@localhost ~]#
#使用命令查询
[root@localhost ~]# rpm -qa | grep vim
vim-minimal-7.0.109-6.el5
#发现只有这个包,说明没安装完整,需要重新安装vim
#下面是安装过程
[root@localhost ~]# yum install -y vim*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vim-X11.x86_64 2:7.0.109-7.2.el5 set to be updated
---> Package vim-common.x86_64 2:7.0.109-7.2.el5 set to be updated
---> Package vim-enhanced.x86_64 2:7.0.109-7.2.el5 set to be updated
---> Package vim-minimal.x86_64 2:7.0.109-7.2.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
========================================================================================
Installing:
Updating:
Transaction Summary
========================================================================================
Install
Upgrade
Total download size: 9.1 M
Downloading Packages:
(1/4): vim-minimal-7.0.109-7.2.el5.x86_64.rpm
(2/4): vim-X11-7.0.109-7.2.el5.x86_64.rpm
(3/4): vim-enhanced-7.0.109-7.2.el5.x86_64.rpm
(4/4): vim-common-7.0.109-7.2.el5.x86_64.rpm
----------------------------------------------------------------------------------------
Total
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installed:
Updated:
Complete!
#安装成功
[root@localhost ~]#
[root@localhost ~]# vim test.txt
#进入vim操作界面
#:q退出界面后,使用命令查看
[root@localhost ~]# rpm -qa | grep vim
vim-enhanced-7.0.109-7.2.el5
vim-common-7.0.109-7.2.el5
vim-X11-7.0.109-7.2.el5
vim-minimal-7.0.109-7.2.el5
(责任编辑:IT) |