When I try to edit a file using vim instead of vi, the following error appeared. How to fix this?
[root@centos6 ~]# vim /etc/httpd/conf/httpd.conf -bash: vim: command not found
Solution:
Simply run yum install command to install vim on CentOS 6.2. This steps has been tested on CentOS 6.2. Assume that you have installed minimal installation type CentOS 6.2 and has setup your own local yum repository. You can use internet CentOS yum repository instead if you have direct internet connection to your server.
How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2
[root@centos6 ~]# yum install vim-enhanced Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.ipserverone.com * extras: centos.ipserverone.com * updates: centos.ipserverone.com Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package vim-enhanced.i686 2:7.2.411-1.6.el6 will be installed --> Processing Dependency: vim-common = 2:7.2.411-1.6.el6 for package: 2:vim-enhanced-7.2.411-1.6.el6.i686 --> Processing Dependency: libgpm.so.2 for package: 2:vim-enhanced-7.2.411-1.6.el6.i686 --> Running transaction check ---> Package gpm-libs.i686 0:1.20.6-12.el6 will be installed ---> Package vim-common.i686 2:7.2.411-1.6.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================= Package Arch Version Repository Size ============================================================================================= Installing: vim-enhanced i686 2:7.2.411-1.6.el6 CentOS6.2-Repository 839 k Installing for dependencies: gpm-libs i686 1.20.6-12.el6 CentOS6.2-Repository 28 k vim-common i686 2:7.2.411-1.6.el6 CentOS6.2-Repository 6.0 M Transaction Summary ============================================================================================= Install 3 Package(s) Total download size: 6.8 M Installed size: 19 M Is this ok [y/N]: y Downloading Packages: --------------------------------------------------------------------------------------------- Total 9.9 MB/s | 6.8 MB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : gpm-libs-1.20.6-12.el6.i686 1/3 Installing : 2:vim-common-7.2.411-1.6.el6.i686 2/3 Installing : 2:vim-enhanced-7.2.411-1.6.el6.i686 3/3 Installed: vim-enhanced.i686 2:7.2.411-1.6.el6 Dependency Installed: gpm-libs.i686 0:1.20.6-12.el6 vim-common.i686 2:7.2.411-1.6.el6 Complete!