旧版本openssl1.0.2k

新版本openssl1.1.1

安装所需环境

yum install wget vim gcc gcc-c++ zlib zlib-devel

下载主程序

wget -c -P /opt/tmp/ https://www.openssl.org/source/openssl-1.1.1.tar.gz

解压缩

cd /opt/tmp/

tar zxvf openssl-1.1.1.tar.gz 

cd opensll-1.1.1

配置程序安装目录

./config shared zlib --prefix=/usr/local/openssl --openssldir=/usr/local/openssl/ssl

显示配置数据

perl configdata.pm --dump

编译安装

make -j 4

make install

查看新安装版本

cd /usr/local/openssl/bin

./openssl version -a

此处显示错误,说明找到不libssl.so.1.1库

./openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

查看新版本openssl关联的动态库

ldd openssl

linux-vdso.so.1 =>  (0x00007fff12142000)

libssl.so.1.1 => not found

libcrypto.so.1.1 => not found

libz.so.1 => /lib64/libz.so.1 (0x00007f702c2e5000)

libdl.so.2 => /lib64/libdl.so.2 (0x00007f702c0e1000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f702bec5000)

libc.so.6 => /lib64/libc.so.6 (0x00007f702baf8000)

/lib64/ld-linux-x86-64.so.2 (0x00007f702c4fb000)

设置关联动态库配置文件

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf.d/openssl-1.1.1.conf

使配置文件生效

ldconfig -v

查看当前openssl版本

openssl version -a

备份openssl当前版本并关联新版本数据

mv /usr/bin/openssl /usr/bin/openssl.old

ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

openssl version -a