如何在 Lightsail 執行個體中安裝 Certbot 套件,以便安裝 Let's Encrypt 憑證?
我想在 Amazon Lightsail 執行個體上安裝 Let's Encrypt 憑證。如何在執行個體中安裝 Certbot 套件以便能夠安裝憑證?
簡短描述
具有 Bitnami 堆疊的 Lightsail 執行個體 (例如 WordPress、LAMP 等) 有自己的安裝工具,稱為 bncert-tool。此工具可用來安裝 Let's Encrypt 憑證。cPanel 和 Plesk 之類的藍圖也有自己的工具可用來進行此作業。這些執行個體便不需要 Certbot 套件。
但是,如果要在其他 Lightsail 執行個體藍圖 (例如 Ubuntu、Amazon Linux 2 等) 上進行安裝,就需要 Certbot 套件。
如需有關在安裝 Certbot 套件之後安裝 Let's Encrypt 憑證的資訊,請參閱如何在 Lightsail 執行個體中安裝標準的 Let's Encrypt SSL 憑證?
解決方案
所有 Linux 發行版本 (Amazon Linux 2 和 FreeBSD 除外) 都可以使用 snapd 來安裝 Certbot 工具。如果您已使用作業系統套件管理員安裝了任何 Certbot 套件 (例如 apt、dnf 或 yum),請先加以移除再安裝 Certbot snap。這可確保當您執行 Certbot 命令時,會使用 snap 而非來自作業系統套件管理員的安裝。您需要執行的確切命令取決於您的作業系統。下列是可用來移除 Certbot 套件的常見命令範例:
sudo apt-get remove certbot
sudo dnf remove certbot
sudo yum remove certbot
執行下列命令來安裝 Certbot 工具:
Amazon Linux 2
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum install -y certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,也請執行下列命令以安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
sudo yum install -y python2-certbot-dns-route53
如果在執行 Certbot 命令時出現 botocore 相容性錯誤,請使用 pip 重新安裝 boto-core。
sudo pip uninstall botocore boto3 && sudo pip install boto3
Ubuntu 16.04、18.04 和 20.04
sudo snap install core; sudo snap refresh core; sudo snap install --classic certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,也請執行下列命令以安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
sudo snap set certbot trust-plugin-with-root=ok sudo snap install --beta certbot-dns-route53 sudo snap connect certbot:plugin certbot-dns-route53
Debian 10.8、9.13、8.7
sudo apt install snapd -y sudo snap install core; sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /sbin/certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,則請執行下列命令來安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
sudo snap install --beta --classic certbot sudo snap set certbot trust-plugin-with-root=ok sudo snap install --beta certbot-dns-route53 sudo snap connect certbot:plugin certbot-dns-route53
CentOS 7.9
sudo yum install epel-release sudo yum-config-manager --enable cr sudo yum install snapd sudo systemctl enable --now snapd.socket sudo ln -s /var/lib/snapd/snap /snap sudo snap install --classic certbot sudo ln -s /var/lib/snapd/snap/bin/certbot /sbin/certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,則請執行下列命令來安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
sudo snap set certbot trust-plugin-with-root=ok sudo snap install --beta certbot-dns-route53 sudo snap connect certbot:plugin certbot-dns-route53
CentOS 8.2
sudo dnf install epel-release sudo dnf upgrade sudo dnf config-manager --enable cr sudo yum install snapd sudo systemctl enable --now snapd.socket sudo ln -s /var/lib/snapd/snap /snap sudo snap install --classic certbot sudo ln -s /var/lib/snapd/snap/bin/certbot /sbin/certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,則請執行下列命令來安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
sudo snap set certbot trust-plugin-with-root=ok sudo snap install --beta certbot-dns-route53 sudo snap connect certbot:plugin certbot-dns-route53
OpenSUSE 15.2
sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2 snappy sudo zypper --gpg-auto-import-keys refresh sudo zypper dup --from snappy sudo zypper install snapd sudo systemctl enable --now snapd sudo zypper in -t pattern apparmor sudo snap install core; sudo snap refresh core; sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,則請執行下列命令來安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
sudo snap set certbot trust-plugin-with-root=ok sudo snap install --beta certbot-dns-route53 sudo snap connect certbot:plugin certbot-dns-route53
FreeBSD 12.2
su pkg install py38-certbot
**注意:**如果您使用方法 1 來安裝萬用字元 Let's Encrypt SSL 憑證,則請執行下列命令來安裝 DNS 外掛程式。在下列命令中,將 route53 取代為網域的 DNS 供應商。若要檢閱支援的 DNS 供應商清單,請參閱 DNS 外掛程式。
pkg install py38-certbot-dns-route53

相關內容
- 已提問 4 個月前lg...
- 已提問 5 個月前lg...
- 已提問 5 個月前lg...
- 已提問 5 個月前lg...
- 已提問 5 個月前lg...
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前