我们用的是letsencrypt的证书
1.安装certbot
certbot
然后进去之后选择软件和系统
笔主的是centos7的,然后就直接yum安装
sudo yum install python-certbot-apache
然后
certbot --apache
但是笔主这里报了个错:
[root@VM_37_3_centos ~]# certbot --apache
Traceback (most recent call last):
File "/usr/bin/certbot", line 9, in <module>
load_entry_point('certbot==0.11.1', 'console_scripts', 'certbot')()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.7/site-packages/certbot/main.py", line 21, in <module>
from certbot import client
File "/usr/lib/python2.7/site-packages/certbot/client.py", line 10, in <module>
from acme import client as acme_client
File "/usr/lib/python2.7/site-packages/acme/client.py", line 31, in <module>
requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 112, in inject_into_urllib3
_validate_dependencies_met()
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 147, in _validate_dependencies_met
raise ImportError("'pyOpenSSL' module missing required functionality. "
ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.
他说这个pyOpenssl
必须要v0.14以上
我们看一下这个现有:
[root@VM_37_3_centos ~]# pip show pyOpenssl
Name: pyOpenSSL
Version: 0.13.1
Summary: Python wrapper module around the OpenSSL library
Home-page: http://pyopenssl.sourceforge.net/
Author: Jean-Paul Calderone
Author-email: exarkun@twistedmatrix.com
License: APL2
Location: /usr/lib64/python2.7/site-packages
Requires:
是0.13的。。。。醉了
好吧,卸载了重新装
pip uninstall pyOpenssl
[root@VM_37_3_centos ~]# pip uninstall pyOpenssl
DEPRECATION: Uninstalling a distutils installed project (pyOpenssl) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pyOpenSSL-0.13.1:
/usr/lib64/python2.7/site-packages/pyOpenSSL-0.13.1-py2.7.egg-info
Proceed (y/n)? y
Successfully uninstalled pyOpenSSL-0.13.1
然后我们就卸载完毕了
装吧
pip install pyOpenssl
然后果然不出所料报错了
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of cryptography
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-SPjUI6/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-eQZ2dp-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-SPjUI6/cryptograp````
y/