在日常的工作在使用yum命令去安装部署NGINX服务时报错了,报错内容如下:

[root@node2 yum.repos.d]# yum install -y nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.bupt.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.20.1-9.el7 will be installed
--> Processing Dependency: nginx-filesystem = 1:1.20.1-9.el7 for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_1)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: redhat-indexhtml for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
--> Running transaction check
---> Package centos-indexhtml.noarch 0:7-9.el7.centos will be installed
---> Package gperftools-libs.x86_64 0:2.6.1-1.el7 will be installed
---> Package nginx-filesystem.noarch 1:1.20.1-9.el7 will be installed
---> Package openssl11-libs.x86_64 1:1.1.1k-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================
 Package                                       Arch                                Version                                        Repository                         Size
==========================================================================================================================================================================
Installing:
 nginx                                         x86_64                              1:1.20.1-9.el7                                 epel                              587 k
Installing for dependencies:
 centos-indexhtml                              noarch                              7-9.el7.centos                                 base                               92 k
 gperftools-libs                               x86_64                              2.6.1-1.el7                                    base                              272 k
 nginx-filesystem                              noarch                              1:1.20.1-9.el7                                 epel                               24 k
 openssl11-libs                                x86_64                              1:1.1.1k-2.el7                                 epel                              1.5 M

Transaction Summary
==========================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total size: 2.4 M
Installed size: 6.7 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/nginx-filesystem-1.20.1-9.el7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7


GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"

问题分析:

主要的报错如下:

GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"

从报错的内容来看是因为缺少一个/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7文件导致的 ,只要去补全这个文件就可以了。


解决方案:

这里有两个解决方案的,实际的话也可以看做是一个解决方案的,都是补全/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7的思路;

方案一:

我这里是两台服务器去部署NGINX时报错这个错误的,但是另一台服务器的部署NGINX服务是没有问题的,所以这里直接从这里拿过来就可以了

我这里是使用了ansible工具来操作的

ansible web2 -m copy -a 'src=/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 dest=/etc/pki/rpm-gpg/'

注:这里的web2是就是使用yum安装ngin应用失败的那台服务器的,具体的可以参考ansible使用方法。

方案二:

是直接去下载这个文件下来,但是这里需要保障服务器是可以连接互联网的,如果是没有属于内网的话,建议采用方案一,或者是下载下来之后使用U盘导进去。

cd /etc/pki/rpm-gpg 
wget https://archive.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7

然后需要执行清理命令

yum clean all

到此,yum安装提示的报错就处理带了。

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

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

更多推荐