升级openssl

1.下载openssl

mkdir /root/spenssl
cd /root/spenssl
wget http://www.openssl.org/source/openssl-1.1.1d.tar.gz
tar -zxvf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d

2.编译安装

./config --prefix=/usr/local/openssl no-zlib #不需要zlib
make && make altinstall

3.备份原配置

mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl/ /usr/include/openssl.bak

4.新版配置

ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

5.修改系统配置

# 写入openssl库文件的搜索路径
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
# 使修改后的/etc/ld.so.conf生效
ldconfig -v

6.查看openssl版本

openssl version  

7.报错:openssl version 提示:/usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

假如你的libssl.so.1.1 文件在/usr/local/openssl/lib/下面,可以这样做

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

8.编译OpenSSL  时报错,错误信息如下

Can't locate IPC/Cmd.pm in @INC (@INC contains: /usr/local/openssl-3.0.7/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /usr/local/openssl-3.0.7/external/perl/Text-Template-1.56/lib) at /usr/local/openssl-3.0.7/util/perl/OpenSSL/config.pm line 19.
BEGIN failed--compilation aborted at /usr/local/openssl-3.0.7/util/perl/OpenSSL/config.pm line 19.
Compilation failed in require at /usr/local/openssl-3.0.7/Configure line 23.
BEGIN failed--compilation aborted at /usr/local/openssl-3.0.7/Configure line 23.

8.1 安装perl-CPAN

yum install -y perl-CPAN

8.2 进入CPAN的shell模式,首次进入需要配置shell,按照提示操作即可(本人perl小白,全部选择默认配置,高手请根据提示自行选择)

perl -MCPAN -e shell

8.3 到这边根据提示,直接默认 yes 一路下去

 8.4 install IPC/Cmd.pm 安装,这边结束了,直接Ctrl + D 退出去