在Azure上使用RedHat8,使用dnf命令安装package时出现SSL证书过期的错误。

Curl error (56): Failure when receiving data from the peer for https://rhui-3.microsoft.com/pulp/repos/content/eus/rhel8/rhui/8.2/x86_64/baseos/os/repodata/repomd.xml [OpenSSL SSL_read: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired, errno 0]

对应方法是无效化subscription manager警告后,重新安装SSL证书。

1. 无效化subscription manager警告

使用sed命令将 enabled=1 改为 enabled=0,无效话subscription manager的警告。

[root@sys-blog ~]# sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf

/etc/yum/pluginconf.d/subscription-manager.conf文件内容如下。

[main]
enabled=0

# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum
disable_system_repos=0

2. 安装SSL证书

使用 dnf命令安装SSL证书。

[root@sys-blog ~]# install rhui-azure-rhel8-eus --disablerepo='*' --enablerepo='*microsoft*'