Amazon-Ec2

在 Amazon Linux AMI 中安裝 certbot nginx

  • September 28, 2021

我有一個非常舊的amazon linux ami,我需要為執行 php 網站的 nginx 安裝 certbot。現在我需要在這個網站上安裝 ssl。但我無法在我的伺服器上安裝 certbot-nginx。每當我嘗試安裝

sudo yum install python2-certbot-nginx.noarch

它向我顯示了一些依賴錯誤。最後像這樣

--> Processing Dependency: python-requests >= 2.6.0 for package: python2-requests-2.6.0-0.el7.noarch
---> Package python2-six.noarch 0:1.9.0-0.el7 will be installed
--> Processing Dependency: python-six >= 1.9.0 for package: python2-six-1.9.0-0.el7.noarch
---> Package setools-libs.x86_64 0:3.3.7-34.23.amzn1 will be installed
--> Finished Dependency Resolution
Error: Package: python2-requests-2.6.0-0.el7.noarch (epel)
          Requires: python-requests >= 2.6.0
          Installed: python26-requests-1.2.3-5.10.amzn1.noarch (@amzn-main)
              python-requests = 1.2.3-5.10.amzn1
Error: Package: python2-acme-1.11.0-1.el7.noarch (epel)
          Requires: python2-cryptography
Error: Package: python2-acme-1.11.0-1.el7.noarch (epel)
          Requires: pyOpenSSL >= 0.13.1
          Installing: python26-pyOpenSSL-0.10-2.8.amzn1.x86_64 (amzn-main)
              pyOpenSSL = 0.10-2.8.amzn1
Error: Package: python2-acme-1.11.0-1.el7.noarch (epel)
          Requires: python2-pyasn1
Error: Package: certbot-1.11.0-1.el7.noarch (epel)
          Requires: systemd
Error: Package: python2-six-1.9.0-0.el7.noarch (epel)
          Requires: python-six >= 1.9.0
          Installed: python26-six-1.8.0-1.23.amzn1.noarch (@amzn-main)
              python-six = 1.8.0-1.23.amzn1
Error: Package: python2-josepy-1.3.0-2.el7.noarch (epel)
          Requires: python2-setuptools
Error: Package: python2-josepy-1.3.0-2.el7.noarch (epel)
          Requires: python2-cryptography
Error: Package: python2-certbot-1.11.0-1.el7.noarch (epel)
          Requires: python2-cryptography >= 1.2.3
Error: Package: python2-acme-1.11.0-1.el7.noarch (epel)
          Requires: pyOpenSSL >= 0.13.1
          Available: python26-pyOpenSSL-0.10-2.8.amzn1.x86_64 (amzn-main)
              pyOpenSSL = 0.10-2.8.amzn1
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

我已經嘗試安裝 yum-utils,**package-cleanup --leaves**但仍然出現以下錯誤。誰能告訴我如何防止這個問題?謝謝。順便說一句,我的伺服器 os-release

NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

誰能幫我這個?我想如果我可以刪除所有這些依賴項問題,那麼我可以安裝 python2-certbot-nginx 並且可以執行 ssl。我能得到什麼幫助嗎?提前致謝。

幾個月前,我在 Amazon linux 中也遇到了類似的問題。通過 pip 安裝 certbot 解決了這個問題。我使用的命令:

pip install virtualenv
virtualenv ~/.certbot
source ~/.certbot/bin/activate
pip install 'setuptools<41'
pip install certbot
pip install 'parsedatetime<2.6'

現在只需發出以下命令即可生成證書

sudo ~/.certbot/bin/certbot certonly --webroot -w /usr/share/nginx/html/example -d example.com 

引用自:https://serverfault.com/questions/1078775