目录
一、Openssl的安装
1. 安装依赖
apt install zlib1g-dev
2. 下载openssl最新版本
wget -c http://www.openssl.org/source/openssl-1.1.1.tar.gz --no-check-certificate
3. 编译安装openssl
tar -zxvf openssl-1.1.1.tar.gz
cd openssl-1.1.1
./config --prefix=/usr/local/openssl shared zlib
4. 备份原来的配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl/ /usr/include/openssl.bak
5. 配置新版本的链接
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
6. 修改系统配置
#写入openssl库文件的搜索路径
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
#使修改后的/etc/ld.so.conf生效
ldconfig -v
7. 查看openssl版本
openssl version
8. 配置环境变量
export LDFLAGS=" -L/usr/local/openssl/lib"
export CPPFLAGS=" -I/usr/local/openssl/include"
export PKG_CONFIG_PATH="/usr/local/openssl/lib/pkgconfig"
二、Python的安装
1. 依赖的安装
apt install libffi-dev
apt-get install build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev zlib1g-dev\
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
2. 下载与安装
cd /usr/local/
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar -zxf Python-3.7.3.tgz
rm Python-3.7.3.tgz
cd Python-3.7.3
./configure --enable-shared --with-openssl=/usr/local/openssl
make && make install
3. 添加库的配置信息
cd /etc/ld.so.conf.d
vim python3.conf
插入:/usr/python/lib或者/usr/local/Python3.7.3/lib
ldconfig