Knowledge Center Monthly Newsletter - March 2025
Stay up to date with the latest from the Knowledge Center. See all new and updated Knowledge Center articles published in the last month and re:Post’s top contributors.
如何在我的 Lightsail 实例中安装 Certbot 软件包以安装 Let's Encrypt 证书?
我想使用 Certbot 软件包在我的 Amazon Lightsail 实例上安装 Let's Encrypt 证书。
简短描述
带有 Bitnami 堆栈的 Lightsail 实例(例如 WordPress 和 LAMP)具有自己名为 bncert-tool 的安装工具来安装 Let's Encrypt 证书。诸如 cPanel 和 Plesk 之类的蓝图也有自己的安装工具,不需要 Certbot 软件包。但是,在其他 Lightsail 实例蓝图(例如 Ubuntu 和 Amazon Linux 2)上安装需要 Certbot 软件包。
解决方法
除 Amazon Linux 2 和 FreeBSD 以外的所有 Linux 发行版都可以使用 snapd 来安装 Certbot 工具。根据您的操作系统(OS)安装 Certbot 工具。
先决条件
删除使用其他操作系统软件包管理器进行安装的所有 Certbot 软件包,例如 apt、dnf 或 yum。以下是可以删除 Certbot 软件包的命令示例:
sudo apt-get remove certbot sudo dnf remove certbot sudo yum remove certbot
**注意:**如果您的域使用 Certbot 网站上的 DNS 插件中列出的 DNS 提供商之一,则必须安装 DNS 插件。
Amazon Linux 2
要在 Amazon Linux 2 上安装 Certbot 工具,请运行以下命令:
sudo yum update sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum install -y certbot
如果您使用“Certbot 用户指南”中列出的 DNS 提供商,请运行以下命令来安装 DNS 插件:
sudo yum install -y python2-certbot-dns-route53
**注意:**将 route53 替换为您的域 DNS 提供商。
如果您遇到 botocore 兼容性错误,则请运行 pip 命令来重新安装 botocore:
sudo pip uninstall botocore boto3 && sudo pip install boto3
Amazon Linux 2023
要在 Amazon Linux 2023 上安装 Certbot 工具,请运行以下命令:
sudo yum update sudo dnf install python3 augeas-libs sudo python3 -m venv /opt/certbot/ sudo /opt/certbot/bin/pip install --upgrade pip sudo /opt/certbot/bin/pip install certbot
Ubuntu 16.04、18.04、20.04 和 22.04
要在 Ubuntu 16.04、18.04、20.04 和 22.04 上安装 Certbot 工具,请运行以下命令:
sudo snap install core; sudo snap refresh core; sudo snap install --classic certbot
如果您使用“Certbot 用户指南”中列出的 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
**注意:**将 route53 替换为您的域 DNS 提供商。
Debian 11、10.8、9.13、8.7
要在 Debian 11、10.8、9.13、8.7 上安装 Certbot 工具,请运行以下命令:
sudo apt install snapd -y sudo snap install core; sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /sbin/certbot
如果您使用“Certbot 用户指南”中列出的 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
**注意:**将 route53 替换为您的域 DNS 提供商。
CentOS 7.9
要在 CentOS 7.9 上安装 Certbot 工具,请运行以下命令:
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
如果您使用“Certbot 用户指南”中列出的 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
**注意:**将 route53 替换为您的域 DNS 提供商。
CentOS 8.2、9
要在 CentOS 8.2 和 9 上安装 Certbot 工具,请运行以下命令:
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
如果您使用“Certbot 用户指南”中列出的 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
**注意:**将 route53 替换为您的域 DNS 提供商。
OpenSUSE 15.4
要在 OpenSUSE 15.4 上安装 Certbot 工具,请运行以下命令:
sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.4 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
如果您使用“Certbot 用户指南”中列出的 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
**注意:**将 route53 替换为您的域 DNS 提供商。
FreeBSD 12.4
要在 FreeBSD 12.4 上安装 Certbot 工具,请运行以下命令:
su pkg install security/py-certbot
如果您使用“Certbot 用户指南”中列出的 DNS 提供商,请运行以下命令来安装 DNS 插件:
pkg install py39-certbot-dns-route53
**注意:**将 route53 替换为您的域 DNS 提供商。
相关信息

相关内容
- 已提问 7 个月前lg...
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前