新版Letsencrypt证书申请及安装流程

2021-03-19   阅读:1973   分类:后端    标签: 服务器

certbot-auto不再支持所有的操作系统!根据作者的说法,certbot团队认为维护certbot-auto在几乎所有流行的UNIX系统以及各种环境上的正常运行是一项繁重的工作,加之certbot-auto是基于python 2编写的,而python 2即将寿终正寝,将certbot-auto迁移至python 3需要大量工作,这非常困难,因此团队决定放弃certbot-auto的维护。

既然如此,现在我们还能继续使用certbot吗?certbot团队使用了基于snap的新的分发方法。

Cerbot官网:https://certbot.eff.org/

1. 环境

操作系统:CentOS 7

Webserver:Nginx

2. 安装letsencrypt

2.1. 安装letsencrypt之前,需要先安装snaps。

a. 先安装epel。

yum install epel-release

b. 安装snapd。

yum install snapd

c. 启用snapd.socket。

systemctl enable --now snapd.socket

d. 创建/var/lib/snapd/snap和/snap之间的链接。

ln -s /var/lib/snapd/snap /snap

e. 退出账号并重新登录,或者重启系统,确保snap启用。

shutdown -r now

f. 将snap更新至最新版本。

snap install core
snap refresh core

2.2. 卸载已安装的certbot。

如果之前在系统上已经部署过certbot,则需要先将其进行卸载。

a. 卸载certbot。

yum remove certbot

b. 根据certbot安装位置删除相关文件。

rm /usr/local/bin/certbot-auto

c. 删除certbot附加软件包。

rm -rf /opt/eff.org/certbot

2.3. 安装certbot。

a. 通过snap安装certbot。

snap install --classic certbot

b. 创建/snap/bin/certbot的软链接,方便certbot命令的使用。

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

3. letsencrypt的使用

3.1. 获取证书。

a. 生成证书。

生成单域名证书

certbot certonly --nginx --email xxx@mail.com -d a.do.com

这里可能会报错,我们只需指定nginx.conf路径即可

指定nginx并生成证书

certbot --nginx-server-root=/usr/local/nginx/conf --nginx certonly -d a.example.com

生成泛域名证书

certbot certonly --manual --preferred-challenges dns -d *. example.com -d example.com --server https://acme-v02.api.letsencrypt.org/directory

b. 更新nginx配置并重启nginx。

3.2. 更新证书。

certbot renew
或者
certbot renew --dry-run


【腾讯云】 爆款2核2G3M云服务器首年 61元,2核2G4M云服务器新老同享 99元/年,续费同价

‘简忆博客’微信公众号 扫码关注‘简忆博客’微信公众号,获取最新文章动态
转载:请说明文章出处“来源简忆博客”。http://www.tpxhm.com/adetail/632.html

×
觉得文章有用就打赏一下文章作者
微信扫一扫打赏 微信扫一扫打赏
支付宝扫一扫打赏 支付宝扫一扫打赏

文章评论(0)

登录
简忆博客壁纸一
简忆博客壁纸二
简忆博客壁纸三
简忆博客壁纸四
简忆博客壁纸五
简忆博客壁纸六
简忆博客壁纸七
简忆博客壁纸八
头像

简忆博客
勤于学习,乐于分享

置顶推荐

打赏本站

如果你觉得本站很棒,可以通过扫码支付打赏哦!
微信扫码:你说多少就多少~
微信扫码
支付宝扫码:你说多少就多少~
支付宝扫码
×