本文首发于我的个人网站: https://hewanyue.com/
本文作者: Hechao
本文链接: https://hewanyue.com/blog/5da16ceb.html
博主在CentOS8上dnf安装PHP的依赖包libmcrypt-devel的时候,死活装不上,一直报错。看了下说是依赖项libmcrypt装不上,报错原因说的是是秘钥校验时缺少主机名。这很奇怪,因为用的是阿里的epel源,之前安装各种软件包都没问题,这次突然就秘钥验证不过了。
[root@CentOS8 php-7.3.10]#yum install libmcrypt-devel -y
Last metadata expiration check: 0:01:31 ago on Sat 02 Nov 2019 07:47:12 PM CST.
Dependencies resolved.
=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
libmcrypt-devel x86_64 2.5.8-26.el8 aliyun 18 k
Installing dependencies:
libmcrypt x86_64 2.5.8-26.el8 aliyun 109 k
Transaction Summary
=====================================================================================================================================
Install 2 Packages
Total size: 127 k
Installed size: 320 k
Downloading Packages:
[SKIPPED] libmcrypt-2.5.8-26.el8.x86_64.rpm: Already downloaded
[SKIPPED] libmcrypt-devel-2.5.8-26.el8.x86_64.rpm: Already downloaded
warning: /var/cache/dnf/aliyun-a19d7e5a690d289a/packages/libmcrypt-2.5.8-26.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
aliyun 0.0 B/s | 0 B 00:00
Curl error (3): URL using bad/illegal format or missing URL for file://https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8 [Invalid file://hostname/, expected localhost or 127.0.0.1 or none]
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
查了下网上很多说法,不过都没有解决疑问。解决方案也五花八门,类似rpm --import /etc/pki/rpm-gpg/RPM*
导入秘钥的,也有建议安装时加选项--force --nodeps
忽略依赖关系的。秘钥导入没用,我本身yum源仓库配置文件也填写了阿里云镜像源的秘钥路径的。忽略依赖关系强制安装的话,担心会不按依赖项,导致其他别的问题,而且这个选项本身也报错了。
后来只能干脆把秘钥检查关了,确实能装上了。
vim /etc/yum.repos.d/aliyun.repo
name=aliyun
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch/
gpgcheck=0
enabled=1
gpgkey=file://https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-$releasever
希望不是因为阿里的安装包被人动过而导致秘钥检查不通过吧,姑且相信吧。记录一下,等后期如果有问题或者有空再来排查原因。
------------------------------------------后记 -----------------------------------
原来当时配置yum源文件的时候不小心画蛇添足了,导致gpgkey文件路径不对,应为gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-$releaseve
,用file://的话,就不需要加协议了,直接写主机名或IP加路径。
要时刻提醒自己还是要仔细,一直不出错不代表没错。
2019.11.10