本地yum源无法使用 ,rpm --import public.gpg.key

Posted daniuunixchina

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了本地yum源无法使用 ,rpm --import public.gpg.key相关的知识,希望对你有一定的参考价值。

一次重装CentOS7系统后,挂载光驱并制作成本地yum源却无法使用yum进行安装,这TM着实有点闹心。o(>﹏<)o

案发现场:

[[email protected] ~]# yum -y install /mnt/Packages/vsftpd-3.0.2-22.el7.x86_64.rpm

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.

解决方法:

[[email protected] ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[[email protected] ~]# yum -y install /mnt/Packages/httpd-2.4.6-67.el7.centos.x86_64.rpm
Examining /mnt/Packages/httpd-2.4.6-67.el7.centos.x86_64.rpm: httpd-2.4.6-67.el7.centos.x86_64
Marking /mnt/Packages/httpd-2.4.6-67.el7.centos.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-67.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-67.el7.centos for package: httpd-2.4.6-67.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-67.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-67.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-67.el7.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-67.el7.centos will be installed

............

用 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY  导入 一般情况下

GPG KEY,一般系统都会有的,在你的linux安装光盘目录下,或者在/etc/pki/rpm-gpg/目录下有一个 PM-GPG-KEY-CentOS-7

如果导入失败 那么 可已将GPG.KEY路径直接加入到你编辑的/etc/yum.repos.d/下的CentOS7.repo 保存退出

然后 yum makecache  元数据缓存创建

参考链接:https://www.cnblogs.com/goon2016vv/p/5625240.html

以上是关于本地yum源无法使用 ,rpm --import public.gpg.key的主要内容,如果未能解决你的问题,请参考以下文章

linux 配置本地yum源

centos 7 配置yum本地源及yum命令使用

Ceph本地yum源配置

Linux配置本地yum源

yum源安装出现rpm --import public.gpg.key

linux运维之配置本地yum源