Step1 : vim /etc/hosts

Step2 : 检查系统中是否存在安装包。rpm -qa|grep vim

Step3: 安装vim  yum -y install vim*

Step 4: 测试 vim /etc/hosts

[root@localhost etc]# vim /etc/hosts
-bash: vim: command not found
[root@localhost etc]# vim hosts
-bash: vim: command not found
[root@localhost etc]# rpm -qa|grep vim
vim-minimal-7.4.629-8.el7_9.x86_64
[root@localhost etc]# yum -y install vim*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.nju.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
Package 2:vim-minimal-7.4.629-8.el7_9.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package vim-X11.x86_64 2:7.4.629-8.el7_9 will be installed
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-X11-7.4.629-8.el7_9.x86_64
---> Package vim-ansible.noarch 0:3.2-1.el7 will be installed
---> Package vim-common.x86_64 2:7.4.629-8.el7_9 will be installed
---> Package vim-enhanced.x86_64 2:7.4.629-8.el7_9 will be installed
---> Package vim-filesystem.x86_64 2:7.4.629-8.el7_9 will be installed
---> Package vim-fugitive.noarch 0:2.5-1.el7 will be installed
---> Package vim-fugitive-gitlab.noarch 0:0~20220701gitb73a8e-1.el7 will be installed
---> Package vim-go.x86_64 0:1.8-3.el7 will be installed
--> Processing Dependency: golang for package: vim-go-1.8-3.el7.x86_64
---> Package vim-gtk-syntax.noarch 0:20130716-1.el7 will be installed
---> Package vim-halibut.noarch 0:1.3-3.el7 will be installed
---> Package vim-jellybeans.noarch 0:1.7-1.el7 will be installed
---> Package vim-toml.noarch 0:0-0.2.20180615git85ba827.el7 will be installed
---> Package vim-trailing-whitespace.noarch 0:1.0-1.20191209git6b7cdec.el7 will be installed
---> Package vim-vimoutliner.noarch 0:0.4.0-8.el7 will be installed
--> Running transaction check
---> Package golang.x86_64 0:1.17.12-1.el7 will be installed
--> Processing Dependency: golang-bin = 1.17.12-1.el7 for package: golang-1.17.12-1.el7.x86_64
--> Processing Dependency: golang-src = 1.17.12-1.el7 for package: golang-1.17.12-1.el7.x86_64
--> Processing Dependency: openssl-devel for package: golang-1.17.12-1.el7.x86_64
---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed
--> Running transaction check
---> Package golang-bin.x86_64 0:1.17.12-1.el7 will be installed
---> Package golang-src.noarch 0:1.17.12-1.el7 will be installed
---> Package openssl-devel.x86_64 1:1.0.2k-25.el7_9 will be installed
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-25.el7_9.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.15.1-54.el7_9 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.15.1-54.el7_9 for package: krb5-devel-1.15.1-54.el7_9.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-54.el7_9.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-54.el7_9.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-54.el7_9.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-54.el7_9.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package libcom_err-devel.x86_64 0:1.42.9-19.el7 will be installed
---> Package libkadm5.x86_64 0:1.15.1-54.el7_9 will be installed
---> Package libselinux-devel.x86_64 0:2.5-15.el7 will be installed
--> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-15.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
--> Running transaction check
---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================================================================
 Package                                                        Arch                                          Version                                                               Repository                                      Size
=========================================================================================================================================================================================================================================
Installing:
 vim-X11                                                        x86_64                                        2:7.4.629-8.el7_9                                                     updates                                        1.2 M
 vim-ansible                                                    noarch                                        3.2-1.el7                                                             epel                                            13 k
 vim-common                                                     x86_64                                        2:7.4.629-8.el7_9                                                     updates                                        5.9 M
 vim-enhanced                                                   x86_64                                        2:7.4.629-8.el7_9                                                     updates                                        1.1 M
 vim-filesystem                                                 x86_64                                        2:7.4.629-8.el7_9                                                     updates                                         11 k
 vim-fugitive                                                   noarch                                        2.5-1.el7                                                             epel                                            45 k
 vim-fugitive-gitlab                                            noarch                                        0~20220701gitb73a8e-1.el7                                             epel                                            12 k
 vim-go                                                         x86_64                                        1.8-3.el7                                                             epel                                            69 k
 vim-gtk-syntax                                                 noarch                                        20130716-1.el7                                                        epel                                           214 k
 vim-halibut                                                    noarch                                        1.3-3.el7                                                             epel                                            11 k
 vim-jellybeans                                                 noarch                                        1.7-1.el7                                                             epel                                            12 k
 vim-toml                                                       noarch                                        0-0.2.20180615git85ba827.el7                                          epel                                           6.1 k
 vim-trailing-whitespace                                        noarch                                        1.0-1.20191209git6b7cdec.el7                                          epel                                           6.0 k
 vim-vimoutliner                                                noarch                                        0.4.0-8.el7                                                           epel                                            66 k
Installing for dependencies:
 golang                                                         x86_64                                        1.17.12-1.el7                                                         epel                                           681 k
 golang-bin                                                     x86_64                                        1.17.12-1.el7                                                         epel                                            99 M
 golang-src                                                     noarch                                        1.17.12-1.el7                                                         epel                                           8.9 M
 gpm-libs                                                       x86_64                                        1.20.7-6.el7                                                          base                                            32 k
 keyutils-libs-devel                                            x86_64                                        1.5.8-3.el7                                                           base                                            37 k
 krb5-devel                                                     x86_64                                        1.15.1-54.el7_9                                                       updates                                        273 k
 libcom_err-devel                                               x86_64                                        1.42.9-19.el7                                                         base                                            32 k
 libkadm5                                                       x86_64                                        1.15.1-54.el7_9                                                       updates                                        179 k
 libselinux-devel                                               x86_64                                        2.5-15.el7                                                            base                                           187 k
 libsepol-devel                                                 x86_64                                        2.5-10.el7                                                            base                                            77 k
 libverto-devel                                                 x86_64                                        0.2.5-4.el7                                                           base                                            12 k
 openssl-devel                                                  x86_64                                        1:1.0.2k-25.el7_9                                                     updates                                        1.5 M

Transaction Summary
=========================================================================================================================================================================================================================================
Install  14 Packages (+12 Dependent packages)

Total download size: 119 M
Installed size: 440 M
Downloading packages:
(1/26): golang-1.17.12-1.el7.x86_64.rpm                                                                                                                                                                           | 681 kB  00:00:02     
(2/26): golang-bin-1.17.12-1.el7.x86_64.rpm                                                                                                                                                                       |  99 MB  00:00:14     
(3/26): gpm-libs-1.20.7-6.el7.x86_64.rpm                                                                                                                                                                          |  32 kB  00:00:00     
(4/26): libcom_err-devel-1.42.9-19.el7.x86_64.rpm                                                                                                                                                                 |  32 kB  00:00:00     
(5/26): krb5-devel-1.15.1-54.el7_9.x86_64.rpm                                                                                                                                                                     | 273 kB  00:00:00     
(6/26): libsepol-devel-2.5-10.el7.x86_64.rpm                                                                                                                                                                      |  77 kB  00:00:00     
(7/26): libselinux-devel-2.5-15.el7.x86_64.rpm                                                                                                                                                                    | 187 kB  00:00:00     
(8/26): libverto-devel-0.2.5-4.el7.x86_64.rpm                                                                                                                                                                     |  12 kB  00:00:00     
(9/26): openssl-devel-1.0.2k-25.el7_9.x86_64.rpm                                                                                                                                                                  | 1.5 MB  00:00:00     
(10/26): golang-src-1.17.12-1.el7.noarch.rpm                                                                                                                                                                      | 8.9 MB  00:00:02     
(11/26): vim-X11-7.4.629-8.el7_9.x86_64.rpm                                                                                                                                                                       | 1.2 MB  00:00:00     
(12/26): vim-ansible-3.2-1.el7.noarch.rpm                                                                                                                                                                         |  13 kB  00:00:00     
(13/26): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm                                                                                                                                                               |  37 kB  00:00:02     
(14/26): vim-enhanced-7.4.629-8.el7_9.x86_64.rpm                                                                                                                                                                  | 1.1 MB  00:00:00     
(15/26): vim-fugitive-2.5-1.el7.noarch.rpm                                                                                                                                                                        |  45 kB  00:00:00     
(16/26): vim-common-7.4.629-8.el7_9.x86_64.rpm                                                                                                                                                                    | 5.9 MB  00:00:00     
(17/26): vim-fugitive-gitlab-0~20220701gitb73a8e-1.el7.noarch.rpm                                                                                                                                                 |  12 kB  00:00:00     
(18/26): vim-filesystem-7.4.629-8.el7_9.x86_64.rpm                                                                                                                                                                |  11 kB  00:00:00     
(19/26): vim-go-1.8-3.el7.x86_64.rpm                                                                                                                                                                              |  69 kB  00:00:00     
(20/26): vim-gtk-syntax-20130716-1.el7.noarch.rpm                                                                                                                                                                 | 214 kB  00:00:00     
(21/26): libkadm5-1.15.1-54.el7_9.x86_64.rpm                                                                                                                                                                      | 179 kB  00:00:02     
(22/26): vim-halibut-1.3-3.el7.noarch.rpm                                                                                                                                                                         |  11 kB  00:00:00     
(23/26): vim-jellybeans-1.7-1.el7.noarch.rpm                                                                                                                                                                      |  12 kB  00:00:00     
(24/26): vim-toml-0-0.2.20180615git85ba827.el7.noarch.rpm                                                                                                                                                         | 6.1 kB  00:00:00     
(25/26): vim-trailing-whitespace-1.0-1.20191209git6b7cdec.el7.noarch.rpm                                                                                                                                          | 6.0 kB  00:00:00     
(26/26): vim-vimoutliner-0.4.0-8.el7.noarch.rpm                                                                                                                                                                   |  66 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                    5.3 MB/s | 119 MB  00:00:22     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:vim-filesystem-7.4.629-8.el7_9.x86_64                                                                                                                                                                              1/26
  Installing : 2:vim-common-7.4.629-8.el7_9.x86_64                                                                                                                                                                                  2/26
  Installing : gpm-libs-1.20.7-6.el7.x86_64                                                                                                                                                                                         3/26
  Installing : 2:vim-enhanced-7.4.629-8.el7_9.x86_64                                                                                                                                                                                4/26
  Installing : vim-fugitive-2.5-1.el7.noarch                                                                                                                                                                                        5/26
  Installing : libcom_err-devel-1.42.9-19.el7.x86_64                                                                                                                                                                                6/26
  Installing : golang-src-1.17.12-1.el7.noarch                                                                                                                                                                                      7/26
  Installing : libkadm5-1.15.1-54.el7_9.x86_64                                                                                                                                                                                      8/26
  Installing : libverto-devel-0.2.5-4.el7.x86_64                                                                                                                                                                                    9/26
  Installing : libsepol-devel-2.5-10.el7.x86_64                                                                                                                                                                                    10/26
  Installing : libselinux-devel-2.5-15.el7.x86_64                                                                                                                                                                                  11/26
  Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                                                                                                                                              12/26
  Installing : krb5-devel-1.15.1-54.el7_9.x86_64                                                                                                                                                                                   13/26
  Installing : 1:openssl-devel-1.0.2k-25.el7_9.x86_64                                                                                                                                                                              14/26
  Installing : golang-bin-1.17.12-1.el7.x86_64                                                                                                                                                                                     15/26
  Installing : golang-1.17.12-1.el7.x86_64                                                                                                                                                                                         16/26
  Installing : vim-go-1.8-3.el7.x86_64                                                                                                                                                                                             17/26
  Installing : vim-fugitive-gitlab-0~20220701gitb73a8e-1.el7.noarch                                                                                                                                                                18/26
  Installing : vim-vimoutliner-0.4.0-8.el7.noarch                                                                                                                                                                                  19/26
  Installing : vim-trailing-whitespace-1.0-1.20191209git6b7cdec.el7.noarch                                                                                                                                                         20/26
  Installing : 2:vim-X11-7.4.629-8.el7_9.x86_64                                                                                                                                                                                    21/26
  Installing : vim-halibut-1.3-3.el7.noarch                                                                                                                                                                                        22/26
  Installing : vim-ansible-3.2-1.el7.noarch                                                                                                                                                                                        23/26
  Installing : vim-toml-0-0.2.20180615git85ba827.el7.noarch                                                                                                                                                                        24/26
  Installing : vim-gtk-syntax-20130716-1.el7.noarch                                                                                                                                                                                25/26
  Installing : vim-jellybeans-1.7-1.el7.noarch                                                                                                                                                                                     26/26
  Verifying  : libselinux-devel-2.5-15.el7.x86_64                                                                                                                                                                                   1/26
  Verifying  : keyutils-libs-devel-1.5.8-3.el7.x86_64                                                                                                                                                                               2/26
  Verifying  : golang-1.17.12-1.el7.x86_64                                                                                                                                                                                          3/26
  Verifying  : vim-fugitive-gitlab-0~20220701gitb73a8e-1.el7.noarch                                                                                                                                                                 4/26
  Verifying  : vim-halibut-1.3-3.el7.noarch                                                                                                                                                                                         5/26
  Verifying  : golang-bin-1.17.12-1.el7.x86_64                                                                                                                                                                                      6/26
  Verifying  : vim-ansible-3.2-1.el7.noarch                                                                                                                                                                                         7/26
  Verifying  : libsepol-devel-2.5-10.el7.x86_64                                                                                                                                                                                     8/26
  Verifying  : libverto-devel-0.2.5-4.el7.x86_64                                                                                                                                                                                    9/26
  Verifying  : libkadm5-1.15.1-54.el7_9.x86_64                                                                                                                                                                                     10/26
  Verifying  : 2:vim-filesystem-7.4.629-8.el7_9.x86_64                                                                                                                                                                             11/26
  Verifying  : vim-toml-0-0.2.20180615git85ba827.el7.noarch                                                                                                                                                                        12/26
  Verifying  : golang-src-1.17.12-1.el7.noarch                                                                                                                                                                                     13/26
  Verifying  : 2:vim-X11-7.4.629-8.el7_9.x86_64                                                                                                                                                                                    14/26
  Verifying  : vim-gtk-syntax-20130716-1.el7.noarch                                                                                                                                                                                15/26
  Verifying  : vim-go-1.8-3.el7.x86_64                                                                                                                                                                                             16/26
  Verifying  : vim-fugitive-2.5-1.el7.noarch                                                                                                                                                                                       17/26
  Verifying  : 1:openssl-devel-1.0.2k-25.el7_9.x86_64                                                                                                                                                                              18/26
  Verifying  : krb5-devel-1.15.1-54.el7_9.x86_64                                                                                                                                                                                   19/26
  Verifying  : vim-jellybeans-1.7-1.el7.noarch                                                                                                                                                                                     20/26
  Verifying  : vim-vimoutliner-0.4.0-8.el7.noarch                                                                                                                                                                                  21/26
  Verifying  : 2:vim-enhanced-7.4.629-8.el7_9.x86_64                                                                                                                                                                               22/26
  Verifying  : gpm-libs-1.20.7-6.el7.x86_64                                                                                                                                                                                        23/26
  Verifying  : vim-trailing-whitespace-1.0-1.20191209git6b7cdec.el7.noarch                                                                                                                                                         24/26
  Verifying  : 2:vim-common-7.4.629-8.el7_9.x86_64                                                                                                                                                                                 25/26
  Verifying  : libcom_err-devel-1.42.9-19.el7.x86_64                                                                                                                                                                               26/26

Installed:
  vim-X11.x86_64 2:7.4.629-8.el7_9  vim-ansible.noarch 0:3.2-1.el7                         vim-common.x86_64 2:7.4.629-8.el7_9                           vim-enhanced.x86_64 2:7.4.629-8.el7_9  vim-filesystem.x86_64 2:7.4.629-8.el7_9
  vim-fugitive.noarch 0:2.5-1.el7   vim-fugitive-gitlab.noarch 0:0~20220701gitb73a8e-1.el7 vim-go.x86_64 0:1.8-3.el7                                     vim-gtk-syntax.noarch 0:20130716-1.el7 vim-halibut.noarch 0:1.3-3.el7         
  vim-jellybeans.noarch 0:1.7-1.el7 vim-toml.noarch 0:0-0.2.20180615git85ba827.el7         vim-trailing-whitespace.noarch 0:1.0-1.20191209git6b7cdec.el7 vim-vimoutliner.noarch 0:0.4.0-8.el7  

Dependency Installed:
  golang.x86_64 0:1.17.12-1.el7            golang-bin.x86_64 0:1.17.12-1.el7  golang-src.noarch 0:1.17.12-1.el7     gpm-libs.x86_64 0:1.20.7-6.el7      keyutils-libs-devel.x86_64 0:1.5.8-3.el7  krb5-devel.x86_64 0:1.15.1-54.el7_9    
  libcom_err-devel.x86_64 0:1.42.9-19.el7  libkadm5.x86_64 0:1.15.1-54.el7_9  libselinux-devel.x86_64 0:2.5-15.el7  libsepol-devel.x86_64 0:2.5-10.el7  libverto-devel.x86_64 0:0.2.5-4.el7       openssl-devel.x86_64 1:1.0.2k-25.el7_9

Complete!
[root@localhost etc]#

 

[root@localhost etc]# vim /etc/hosts
[root@localhost etc]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.8.136 oracle-db-19c.centlinux.com oracle-db-19c
[root@localhost etc]# 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐