Certbot 安装Let’s Encrypt遇到的各种坑的解决办法

今天安装 Certbot 时遇到各种问题,踩了各种坑,记录下来,分享给大家

我的Linux系统是CentOS7(cat /etc/redhat-release #查看Linux版本),所以安装官网给的安装过程为:

yum install epel-release

sudo yum install certbot-nginx

不同的版本有不同的安装过程,上官网查看各个版本的安装

安装成功后,

通过命令一键生成证书,然后就出现各种问题

sudo certbot --nginx 

首先,执行命令的时候报错:

ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.

提示pyOpenSSL版本低然后就更新版本

pip install -U pyOpenSSL

更新完版本后,查看一下pyOpenSSL版本

pip show pyOpenSSL
Metadata-Version: 2.0
Name: pyOpenSSL
Version: 17.5.0
Summary: Python wrapper module around the OpenSSL library
Home-page: https://pyopenssl.org/
Author: Hynek Schlawack
Author-email: [email protected]
Installer: pip
License: Apache License, Version 2.0
Location: /usr/lib/python2.7/site-packages
Requires: six, cryptography

发现版本为 17.5.0,发现跟系统提示要求的0.14版本不一样 ,不管了。再执行一下生成命令试试,还是报同样的错误。既然它要求pyOpenSSL必须是0.14版本,那就按照要求安装一个0.14版本的吧。

pip install pyOpenSSL==0.14

在查看一下版本,的确是0.14的,那应该没问题了吧。

Metadata-Version: 1.1
Name: pyOpenSSL
Version: 0.14
Summary: Python wrapper module around the OpenSSL library
Home-page: https://github.com/pyca/pyopenssl
Author: Jean-Paul Calderone
Author-email: [email protected]
License: APL2
Location: /usr/lib/python2.7/site-packages
Requires: cryptography, sixsudo certbot --nginx

再继续执行生成证书命令:

sudo certbot --nginx

没有天理了,还是报错,在百度查的所有的方案,什么删除pyOpenSSL重新安装啊。删除cetbot重新安装啊。各种招,都不好使,或者开始报其他的错误了,一环接着一环。不知道为什么别人安装那么的顺利呢。

这种情况必须放大招:翻墙google,浪费那么长时间,你说我刚开始就google多好。找到国外网站的解决办法:

yum install http://cbs.centos.org/kojifiles/packages/pyOpenSSL/16.2.0/3.el7/noarch/python2-pyOpenSSL-16.2.0-3.el7.noarch.rpm

搞定。

我把我遇到的各种问题,踩过的坑分别列出来,供大家参考:

问题:pkg_resources.DistributionNotFound: The 'certbot==0.22.0'
     distribution was not found and is required by the application

解决:pip install certbot==0.22.0
问题:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

解决:pip install pyOpenSSL==16.2.0
问题:raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3'

解决:pip install -U urllib3
问题:pkg_resources.ContextualVersionConflict:
(idna2.6(/usr/lib64/python3.4/site-packages), 
Requirement.parse('idna<2.6,>=2.5'), {'requests'})

解决:pip install idna<2.6


推荐阅读


技术:大牛:你真的懂反射吗?

技术:设计图都不会画,还想做”架构师“?

技术:漫画:煮酒论语言 

技术:Google在推动AI普及又往前迈了一步-Learn with Google AI

技术:项目有BUG?代码审查没做好?没关系!SonarQube详细使用教程 

技术:30分钟如何学会使用Shiro 


工具:如何通过技术手段 “干掉” 视频APP里讨厌的广告?

工具:通过技术手段 “干掉” 视频APP里讨厌的广告之(腾讯视频)


干货分享:


分享:1T 软件开发视频资源分享

分享:深度机器学习56G视频资源分享


博主11年java开发经验,现从事智能语音工作的研发,关注微信公众号与博主进行技术交流!更过干货资源等你来拿!


猜你喜欢

转载自blog.csdn.net/mxw2552261/article/details/79730757