When a centos host is used,-bash: vim: command not found occurs when vim is used. Only vi can be used. How can we install vim?
Enter the rpm-qa | grep vim command. If vim is correctly installed, the following three lines of code are returned:
[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
If one of them is missing, such as vim-enhanced, run the yum-y install vim-enhanced command to install it:
Yum-y install vim-enhanced
If none of the above three results are returned, you can directly use the yum-y install vim * command.
Yum-y install vim * 2. [Root @ localhost ~] # Ll # The part omitted...-rwxr -- r -- 1 root34 Apr 26 test.txt#use vimto open the test.txt File[Root @ localhost ~] # Vim test.txt-bash: vim: command not found [root @ localhost ~] ## Query using commands[Root @ localhost ~] # Rpm-qa | grep vimvim-minimal-7.0.109-6.el5 # found only this package, indicating that the installation is not complete, you need to reinstall vim # The following is the installation process [root @ localhost ~] # Yum install-y vim * Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* Addons: mirrors.grandcloud.cn* Base: mirrors.grandcloud.cn* Extras: mirrors.grandcloud.cn* Updates: mirrors. grandcloud. cnSetting up Install ProcessResolving 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. 0.109-7.2.el5 set to be updated ---> Package vim-enhanced.x86_64. 0.109-7.2.el5 set to be updated ---> Package vim-minimal.x86_64. 0.109-7.2.el5 set to be updated --> Finished Dependency ResolutionDependencies Resolved ================== ========================================================== ==================================PackageArchVersionRepositorySize = ========================================================== ========= Installing:Vim-X11X86_642: 7. 0.109-7.2.el5Base1.0 MVim-commonX86_642: 7. 0.109-7.2.el5Base6.4 MVim-enhancedX86_642: 7. 0.109-7.2.el5Base1.3 MUpdating:Vim-minimalX86_642: 7. 0.109-7.2.el5Base334 kTransaction Summary ======================================== ========================================================== ============ Install3 Package (s) Upgrade1 Package (s) Total download size: 9.1 MDownloading Packages :( 1/4): vim-minimal-7.0.109-7.2.el5.x86_64.rpm| 334 kB00: 00(2/4): vim-X11-7.0.109-7.2.el5.x86_64.rpm| 1.0 MB00:03(3/4): vim-enhanced-7.0.109-7.2.el5.x86_64.rpm| 1.3 MB00:03(4/4): vim-common-7.0.109-7.2.el5.x86_64.rpm| 6.4 MB00: 21Total314 kB/s | 9.1 MB00:29Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning TransactionInstalling: Vim-common1/5Installing: Vim-X112/5Updating: Vim-minimal3/5Installing: Vim-enhanced4/5Cleanup: Vim-minimal5/5Installed:Vim-X11.x86_64. 0.109-7.2.el5Vim-common.x86_64. 0.109-7.2.el5Vim-enhanced.x86_64. 0.109-7.2.el5Updated:Vim-minimal.x86_64. 0.109-7.2.el5Complete! # Installation successful[Root @ localhost ~] #[Root @ localhost ~] # Vim test.txt# Enter the vim operation interface#: After exiting the q interface, use the command to view[Root @ localhost ~] # Rpm-qa | grep vimvim-enhanced-7.0.109-7.2.el5vim-common-7.0.109-7.2.el5vim-X11-7.0.109-7.2.el5vim-minimal-7.0.109-7.2.el5