Centos安装部署openssl
部署
操作系统:CentOS:7.4,perl版本:v5.16.3,opensearch版本:3.0.8
1.下载地址:https://www.openssl.org/source/
2.安装cmd.pm模块,不然编译的时候会引发【Can‘t locate IPC/Cmd.pm in @INC】错误。
[root@centos7 ~]# yum install -y perl-CPAN
# 进入CPAN的shell模式,首次进入需要配置shell,按照提示一直回车,要等久一点
[root@centos7 ~]# perl -MCPAN -e shell
# 在shell中安装缺少的模块,要等久一点
cpan[1]> install IPC/Cmd.pm
3.编译部署
./config --prefix=/usr/local/openssl
make
make install
4.这一步一定要有!!LD_LIBRARY_PATH环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径。当执行函数动态链接.so时,如果此文件不在缺省目录下‘/lib' and ‘/usr/lib',那么就需要指定环境变量LD_LIBRARY_PATH
echo 'export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/openssl/lib64' >> /etc/profile
source /etc/profile
不然报错:
[root@iz2ze6ktmxsmwai5zbqy4wz conf]# /usr/local/openssl/bin/openssl version
/usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
5.替换
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
报错
1.若Python运行报错
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See:
降低版本
pip uninstall urllib3
pip install urllib3==1.26.6
本文版权归作者所有,欢迎转载,请务必添加原文链接。