在Amazon Linux2023上安装Let's Encrypt SSL证书遇阻求助
问题描述
尝试为Nginx获取Let's Encrypt SSL证书,已通过以下命令成功安装EPEL源:
$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm $ sudo rpm -ihv --nodeps ./epel-release-latest-8.noarch.rpm
但执行sudo yum install python3-certbot-nginx或sudo dnf install python3-certbot-nginx时,出现依赖错误:
Problem: package certbot-1.22.0-1.el8.noarch requires python3-certbot = 1.22.0-1.el8,
but none of the providers can be installed
- conflicting requests
- nothing provides python3.6dist(setuptools) >= 39.0.1 needed by python3-certbot-1.22.0-1.el8.noarch
- nothing provides python3.6dist(cryptography) >= 2.5.0 needed by python3-certbot-1.22.0-1.el8.noarch
- nothing provides python3.6dist(configobj) >= 5.0.6 needed by python3-certbot-1.22.0-1.el8.noarch
- nothing provides python3.6dist(distro) >= 1.0.1 needed by python3-certbot-1.22.0-1.el8.noarch
- nothing provides /usr/bin/python3.6 needed by python3-certbot-1.22.0-1.el8.noarch
- nothing provides python3.6dist(pytz) needed by python3-certbot-1.22.0-1.el8.noarch
- nothing provides python(abi) = 3.6 needed by python3-certbot-1.22.0-1.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages)
了解到可能需要安装Code Ready Builder但未成功,询问如何安装该源,以及是否存在其他操作错误和解决方法。
解决方案
一、正确安装Code Ready Builder源
对于RHEL/CentOS 8系统,Code Ready Builder(CRB)是提供缺失依赖的必要源,根据系统版本执行对应命令:
# 针对CentOS 8 sudo dnf install -y dnf-plugins-core sudo dnf config-manager --set-enabled powertools # 针对RHEL 8 sudo dnf install -y dnf-plugins-core sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
注:CentOS 8中的powertools是RHEL的codeready-builder等价源。
二、修复EPEL源的异常安装
你之前使用--nodeps参数安装EPEL源,可能破坏了系统依赖关联,重新正确安装:
# 卸载现有EPEL包 sudo rpm -e epel-release # 重新安装,不使用--nodeps参数 sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
三、安装Certbot及Nginx插件
完成源配置后,执行以下命令安装:
sudo dnf install -y python3-certbot-nginx
四、替代方案:使用Snap安装Certbot
如果上述源配置仍无法解决问题,可采用Let's Encrypt官方推荐的Snap安装方式:
# 安装Snapd服务 sudo dnf install -y snapd sudo systemctl enable --now snapd.socket sudo ln -s /var/lib/snapd/snap /snap # 安装Certbot sudo snap install --classic certbot # 创建系统路径软链接 sudo ln -s /snap/bin/certbot /usr/bin/certbot
安装完成后即可通过certbot --nginx命令获取并配置SSL证书。
内容的提问来源于stack exchange,提问作者Sanmi Akande
相关产品推荐
相关产品推荐

