Let’s Encrypt的安装和使用

安装步骤

1. 安装snapd(待施工)。

2. 确保snapd是最新的,可以通过以下命令进行重新安装。

$ sudo snap install core
$ sudo snap refresh core

3. 卸载certbot-auto和任何certbot系统包。

$ sudo apt-get remove certbot
$ sudo dnf remove certbot
$ sudo yum remove certbot

4. 安装Certbot。

$ sudo snap install --classic certbot

5. 关联Certbot命令。

$ sudo ln -s /snap/bin/certbot /usr/bin/certbot

6. 选择Certbot运行模式。

# 生成并安装证书
$ sudo certbot --nginx
# 只生成证书
$ sudo certbot certonly --nginx

7. 测试自动刷新功能。

$ sudo certbot renew --dry-run

# 上述命令被安装在下列三个地址之一之中:
# /etc/crontab/
# /etc/cron./
# systemctl list-timers

8. 访问目标域名测试证书是否生效, https://www.yourwebsite/注意服务器防火墙或安全组规则

参考

  1. Let’s Encrypt官网 – https://letsencrypt.org/zh-cn/getting-started/
  2. Certbot官网CentOS8版手册 – https://certbot.eff.org/instructions?ws=nginx$os=centosrhel8