Linux执行yum install报错
目录
一、报错信息
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 downloadthe 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 usefor 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: mitaka
翻译:
您已经启用了通过GPG键检查包。这是一件好事。
但是,您没有安装任何GPG公钥。您需要下载希望安装的包的密钥;并安装它们。你可以通过运行以下命令:
rpm --import public.gpg.Key
或者,您可以在存储库部分的gpgkey选项中指定您希望用于存储库的键的url, yum将为您安装它。
有关更多信息,请与您的发行版或包提供商联系。
问题库:mitaka
二、报错分析
执行yum list并未报错,可能没有安装任何GPG公钥,需要下载并安装的包的密钥,并安装它们
三、解决方法
1.先尝试提示的命令,下载并安装centos GPG公钥
# rpm --import public.gpg.Key
2.若执行失败,则进行后续步骤
用find命令找到GPG公钥,然后使用rpm --import配置yum入系统的RPM-GPG-KEY
# find / -name RPM-GPG-KEY-CentOS*
# rpm --import RPM-GPG-KEY-CentOS-7
# rpm --import RPM-GPG-KEY-CentOS-Testing-7
注:注意我执行命令的目录,是在GPG公钥的所在目录;
执行时也可以写GPG公钥的绝对路径例如:
# rpm --import /mnt/mitaka/RPM-GPG-KEY-CentOS-7
# rpm --import /mnt/mitaka/RPM-GPG-KEY-CentOS-Testing-7
# yum clean all
3.然后就可以使用yum命令安装包
# yum install -y packagename