在执行yum命令时,出现以下异常

[root@hisdb1 yum.repos.d]# yum -y install gcc

Loaded plugins: fastestmirror, langpacks


You have enabled checking of packages via GPG keys. This is a good thing.

However, you do not have any GPG public keys installed. You need to download

the keys for packages you wish to install and install them.

You can do that by running the command:

    rpm --import public.gpg.key



Alternatively you can specify the url to the key you would like to use

for a repository in the 'gpgkey' option in a repository section and yum

will install it for you.


For more information contact your distribution or package provider.


Problem repository: centos7


查询资料确认是系统检查不到GPG公匙,执行以下命令,

[root@hisdb1 ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

再次安装gcc,无异常发生

[root@hisdb1 ~]# yum install -y gcc

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package gcc.x86_64 0:4.8.5-44.el7 will be installed

--> Processing Dependency: cpp = 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64

--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-44.el7.x86_64

--> Running transaction check

---> Package cpp.x86_64 0:4.8.5-44.el7 will be installed

---> Package glibc-devel.x86_64 0:2.17-317.el7 will be installed

--> Processing Dependency: glibc-headers = 2.17-317.el7 for package: glibc-devel-2.17-317.el7.x86_64

--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-317.el7.x86_64

--> Running transaction check

---> Package glibc-headers.x86_64 0:2.17-317.el7 will be installed

--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-317.el7.x86_64

--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-317.el7.x86_64

--> Running transaction check

---> Package kernel-headers.x86_64 0:3.10.0-1160.el7 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


=============================================================================================================================

 Package                          Arch                     Version                           Repository                 Size

=============================================================================================================================

Installing:

 gcc                              x86_64                   4.8.5-44.el7                      centos7                    16 M

Installing for dependencies:

 cpp                              x86_64                   4.8.5-44.el7                      centos7                   5.9 M

 glibc-devel                      x86_64                   2.17-317.el7                      centos7                   1.1 M

 glibc-headers                    x86_64                   2.17-317.el7                      centos7                   690 k

 kernel-headers                   x86_64                   3.10.0-1160.el7                   centos7                   9.0 M

Transaction Summary

=============================================================================================================================

Install  1 Package (+4 Dependent packages)


Total download size: 33 M

Installed size: 59 M

Downloading packages:

-----------------------------------------------------------------------------------------------------------------------------

Total                                                                                         45 MB/s |  33 MB  00:00:00    

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : cpp-4.8.5-44.el7.x86_64                                                                                   1/5

  Installing : kernel-headers-3.10.0-1160.el7.x86_64                                                                     2/5

  Installing : glibc-headers-2.17-317.el7.x86_64                                                                         3/5

  Installing : glibc-devel-2.17-317.el7.x86_64                                                                           4/5

  Installing : gcc-4.8.5-44.el7.x86_64                                                                                   5/5

  Verifying  : glibc-devel-2.17-317.el7.x86_64                                                                           1/5

  Verifying  : gcc-4.8.5-44.el7.x86_64                                                                                   2/5

  Verifying  : kernel-headers-3.10.0-1160.el7.x86_64                                                                     3/5

  Verifying  : glibc-headers-2.17-317.el7.x86_64                                                                         4/5

  Verifying  : cpp-4.8.5-44.el7.x86_64                                                                                   5/5


Installed:

  gcc.x86_64 0:4.8.5-44.el7                                                                                                 


Dependency Installed:

  cpp.x86_64 0:4.8.5-44.el7                   glibc-devel.x86_64 0:2.17-317.el7     glibc-headers.x86_64 0:2.17-317.el7   

  kernel-headers.x86_64 0:3.10.0-1160.el7   


Complete!