如果还没有安装过 pip , 就用 yum install python-pip 安装,然后就升级 pip:
# pip install –upgrade pip
- 查看官方版本 # pip search certbot ;
- 卸载yum安装的certbot和pyOpenSSL: # yum remove certbot pyOpenSSL;
- pip安装certbot: # pip install certbot certbot-nginx certbot-apache
- 如果遇到 Python.h或者pyconfig.h找不到的错误,# yum install -y python-devel;
- 如果找不到opensslv.h头文件,# yum install -y openssl-devel;
- 查看所有已经安装的证书: # certbot certificates。
添加或者 renew 单独证书:
# certbot --apache -d mydomain.yj777.cn certonly
Renew 所有证书,可以把下面的行写到 cronjob。
15 3 1,15 * * /usr/bin/certbot renew –quiet
== 2018/1/20 后记:
如果运行 certbot certificates 看到错误:certbot ImportError: No module named OpenSSL
可以考虑,重新安装 pyOpenSSL 模块。
也就是先 pip uninstall certbot pyOpenSSL
再 pip install cerbot 即可, pyOpenSSL 会自动安装。
== 2018/2/5 后记:
遇到 " OSError: ctypes.util.find_library() did not manage to locate a library called 'augeas'" 错误:
yum install augeas-libs
遇到:“ImportError: No module named ndg.httpsclient.ssl_peer_verification” 错误:
pip install ndg-httpsclient
遇到:“UnknownExtra: requests 2.6.0 has no such extra feature ‘security’” 错误:
# pip install acme –upgrade
以上基本上能解决大部分的 certbot(Let’s Encrypt) 安装和升级中发现的问题,如果还有问题,就点击联系我们,留言吧。我们会提供有偿的支持服务。
如果是在 CentOS6 上部署的话, 需要先升级 Python:
# yum install -y epel-release
# yum install -y python34
# curl -O https://bootstrap.pypa.io/get-pip.py
# sudo python3 get-pip.py
然后就可以运行 pip 命令了。
— 补充:
原先 Apache 认证器的,如果 Web 服务器切换成 Nginx 了, 可以直接用
# /usr/local/bin/certbot renew –nginx -d domain_name –no-redirect
更新证书
crontab 的写法,每周三,凌晨 4:00 更新:
00 4 * * 3 /usr/local/bin/certbot renew –quiet –noninteractive –installer nginx –pre-hook “service nginx stop” –post-hook “service nginx start”