Table of Contents
In this article, I will explain how to Install VIM Editor on Linux (RHEL / CentOS 7/8) Using 6 Easy Steps. VIM is known as Vi Improved. It is basically the improved version of vi editor which most of the Linux Professionals use in their day to day Life. It is a free and open source text editor which supports recording feature as well. This tool also provides many other cool features like ability to split window into multiple windows and multiple tabs which allows to work on multiple files.
Install VIM Editor on Linux (RHEL/CentOS 7/8)
Also Read: 6 Popular Examples to Find Files and directories owned by Group in Linux/Unix
Step 1: Prerequisites
a) You should have a running RHEL/CentOS 7/8
System.
b) You should have yum
utility installed in your System. Please Check Top 22 YUM Command Examples in RedHat/CentOS 7 to know more about yum
utility.
c) You should have sudo
access to run privilege commands. Please Check How to Add User to Sudoers to know more about providing sudo
access to the User.
Step 2: Update Your System
Before installing VIM Editor in Linux you need to first update your System using yum update -y
command as shown below. This step is very important to ensure all the installed packages are fully updated with the latest available releases. Sometimes old release can cause the failure of any new package installation. Hence it is absolutely necessary to update your System before installing any new packages.
[root@localhost ~]# yum update -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirrors.estointernet.in * epel: download.nus.edu.sg * extras: centos.mirrors.estointernet.in * updates: centos.mirrors.estointernet.in Resolving Dependencies --> Running transaction check ---> Package ca-certificates.noarch 0:2019.2.32-76.el7_7 will be updated ---> Package ca-certificates.noarch 0:2020.2.41-70.0.el7_8 will be an update ---> Package curl.x86_64 0:7.29.0-57.el7 will be updated ---> Package curl.x86_64 0:7.29.0-57.el7_8.1 install vim editor will be an update ---> Package dbus.x86_64 1:1.10.24-13.el7_6 install vim editor will be updated ---> Package dbus.x86_64 1:1.10.24-14.el7_8 install vim will be an update ---> Package dbus-libs.x86_64 1:1.10.24-13.el7_6 install vim will be updated ---> Package dbus-libs.x86_64 1:1.10.24-14.el7_8 install vim will be an update ---> Package grub2.x86_64 1:2.02-0.81.el7.centos install vim will be updated ---> Package grub2.x86_64 1:2.02-0.86.el7.centos install vim will be an update ---> Package grub2-common.noarch 1:2.02-0.81.el7.centos will be updated ---> Package grub2-common.noarch 1:2.02-0.86.el7.centos will be an update ---> Package grub2-pc.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-pc.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package grub2-pc-modules.noarch 1:2.02-0.81.el7.centos will be updated ---> Package grub2-pc-modules.noarch 1:2.02-0.86.el7.centos will be an update ---> Package grub2-tools.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-tools.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package grub2-tools-extra.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-tools-extra.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package grub2-tools-minimal.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-tools-minimal.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-demo.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-demo.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-src.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-src.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-11-openjdk.x86_64 1:11.0.7.10-4.el7_8 will be updated ---> Package java-11-openjdk.x86_64 1:11.0.8.10-0.el7_8 will be an update ---> Package java-11-openjdk-headless.x86_64 1:11.0.7.10-4.el7_8 will be updated ---> Package java-11-openjdk-headless.x86_64 1:11.0.8.10-0.el7_8 will be an update ---> Package kernel.x86_64 0:3.10.0-1127.19.1.el7 will be installed ---> Package kernel-headers.x86_64 0:3.10.0-1127.10.1.el7 will be updated ---> Package kernel-headers.x86_64 0:3.10.0-1127.19.1.el7 will be an update ---> Package kernel-tools.x86_64 0:3.10.0-1127.10.1.el7 will be updated ---> Package kernel-tools.x86_64 0:3.10.0-1127.19.1.el7 will be an update ---> Package kernel-tools-libs.x86_64 0:3.10.0-1127.10.1.el7 will be updated ---> Package kernel-tools-libs.x86_64 0:3.10.0-1127.19.1.el7 will be an update ---> Package libcurl.x86_64 0:7.29.0-57.el7 will be updated ---> Package libcurl.x86_64 0:7.29.0-57.el7_8.1 will be an update ---> Package libgudev1.x86_64 0:219-73.el7_8.6 will be updated ---> Package libgudev1.x86_64 0:219-73.el7_8.9 will be an update ---> Package libguestfs.x86_64 1:1.40.2-9.el7 will be updated ---> Package libguestfs.x86_64 1:1.40.2-9.el7_8.1 will be an update ---> Package libguestfs-tools.noarch 1:1.40.2-9.el7 will be updated ---> Package libguestfs-tools.noarch 1:1.40.2-9.el7_8.1 will be an update ---> Package libguestfs-tools-c.x86_64 1:1.40.2-9.el7 will be updated ---> Package libguestfs-tools-c.x86_64 1:1.40.2-9.el7_8.1 will be an update
Step 3: Install VIM Editor on Linux (RHEL / CentOS 7/8)
If you want to Install VIM Editor on Linux then you need to use yum install vim-enhanced -y
command as shown below. This command will download the latest vim-enhanced
package release from the enabled repository and install in your System.
[root@localhost ~]# yum install vim-enhanced -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirrors.estointernet.in * epel: download.nus.edu.sg * extras: centos.mirrors.estointernet.in * updates: centos.mirrors.estointernet.in Resolving Dependencies --> Running transaction check ---> Package vim-enhanced.x86_64 2:7.4.629-6.el7 will be installed --> Processing Dependency: vim-common = 2:7.4.629-6.el7 for package: 2:vim-enhanced-7.4.629-6.el7.x86_64 --> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64 --> Running transaction check ---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed ---> Package install vim-common.x86_64 2:7.4.629-6.el7 will be installed --> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-6.el7.x86_64 --> Running transaction check ---> Package vim-filesystem.x86_64 2:7.4.629-6.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: vim-enhanced x86_64 2:7.4.629-6.el7 base 1.1 M Installing for dependencies: gpm-libs x86_64 1.20.7-6.el7 base 32 k vim-common x86_64 2:7.4.629-6.el7 base 5.9 M vim-filesystem x86_64 2:7.4.629-6.el7 base 11 k Transaction Summary ======================================================================================================================================================================== Install 1 Package (+3 Dependent packages) Total download size: 7.0 M Installed size: 23 M Downloading packages: (1/4): gpm-libs-1.20.7-6.el7.x86_64.rpm | 32 kB 00:00:00 (2/4): vim-enhanced-7.4.629-6.el7.x86_64.rpm | 1.1 MB 00:00:00 (3/4): vim-filesystem-7.4.629-6.el7.x86_64.rpm | 11 kB 00:00:00 (4/4): vim-common-7.4.629-6.el7.x86_64.rpm | 5.9 MB 00:00:01 -----------------------------------------------------------------------------------------------------------------------------------/code------------------------------------- Total 4.0 MB/s | 7.0 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 2:vim-filesystem-7.4.629-6.el7.x86_64 1/4 Installing : 2:vim-common-7.4.629-6.el7.x86_64 2/4 Installing : gpm-libs-1.20.7-6.el7.x86_64 3/4 Installing : 2:vim-enhanced-7.4.629-6.el7.x86_64 4/4 Verifying : gpm-libs-1.20.7-6.el7.x86_64 1/4 Verifying : 2:vim-enhanced-7.4.629-6.el7.x86_64 2/4 Verifying : 2:vim-common-7.4.629-6.el7.x86_64 3/4 Verifying : 2:vim-filesystem-7.4.629-6.el7.x86_64 4/4 Installed: vim-enhanced.x86_64 2:7.4.629-6.el7 Dependency Installed: gpm-libs.x86_64 0:1.20.7-6.el7 vim-common.x86_64 2:7.4.629-6.el7 vim-filesystem.x86_64 2:7.4.629-6.el7 Complete!
Step 4: Check VIM Editor Version
After successful installation you can check VIM editor version using vim --version
command as shown below. As shown in the output current VIM editor version is 7.4
.
[root@localhost ~]# vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 9 2019 03:17:15) Included patches: 1-207, 209-629 Modified by <bugzilla@redhat.com> Compiled by <bugzilla@redhat.com>
--version
: Print version information and exit. More information can be checked on VIM Man Page.
Step 5: Test Your VIM Editor
You can test the VIM editor installation by creating a new file as shown below. Here we are creating a file hello.txt
using vim hello.txt
command. Then Save and Exit the file by pressing Esc
then Press :(colon)
and then provide wq!
[root@localhost ~]# vim hello.txt Hi there How are you today ?
Step 6: Check all the Options Available with VIM Editor
If you want to check all the options available with VIM editor then you need to use vim --help
command as shown below.
[root@localhost ~]# vim --help VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 9 2019 03:17:15) usage: vim [arguments] [file ..] edit specified file(s) or: vim [arguments] - read text from stdin or: vim [arguments] -t tag edit file where tag is defined or: vim [arguments] -q [errorfile] edit file with first error Arguments: -- Only file names after this -v Vi mode (like "vi") -e Ex mode (like "ex") -E Improved Ex mode -s Silent (batch) mode (only for "ex") -d Diff mode (like "vimdiff") -y Easy mode (like "evim", modeless) -R Readonly mode (like "view") -Z Restricted mode (like "rvim") -m Modifications (writing files) not allowed -M Modifications in text not allowed -b Binary mode -l Lisp mode -C Compatible with Vi: 'compatible' -N Not fully Vi compatible: 'nocompatible' -V[N][fname] Be verbose [level N] [log messages to fname]
Popular Recommendations:-
Unix/Linux Find Files/Directories owned by a Particular User(5 Useful Examples)
Unix/Linux md5sum Command Examples to Verify Checksum
5 Best Methods to Extract .gz File in Linux using gunzip, gzip and tar tool
12 Popular Unix/Linux uname command examples(How to Get Kernel Version)
How to Transfer Files to AWS EC2 Instance Using WinSCP in 3 Easy Steps
6 Easy Steps to Install Sendmail command in Linux (RHEL/CentOS 7/8)
Easy Steps to Install GCC(C and C++ Compiler) on CentOS 7
How to Transfer Files to an AWS EC2 Instance Using WinSCP in 3 Easy Steps