1、下载与安装
wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1t.tar.gz
tar -zxvf openssl-1.1.1t.tar.gz
cd openssl-1.1.1t/
./config --prefix=/usr/local/ssl
make
sudo make install
2、完成后添加软链接
mv /usr/bin/openssl /usr/bin/oldopenssl
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/lib/libssl.so.1.1 /usr/lib64/
ln -s /usr/local/ssl/lib/libcrypto.so.1.1 /usr/lib64/
3、验证
openssl version
4、python中报错
Traceback (most recent call last):
File "salt.py", line 1, in <module>
import requests
File "/home/tianqiurong.vendor/.local/lib/python3.8/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/home/tianqiurong.vendor/.local/lib/python3.8/site-packages/urllib3/__init__.py", line 42, in <module>
raise ImportError(
ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168
解决方式如下:
pip install urllib3==1.26.15
小知识
python -c "import ssl; print(ssl.OPENSSL_VERSION)" #查看python中使用的ssl版本