问题发现
执行openssl version 发现openssl版本还是显示之前的版本
解决方案
1、故重新编译、安装zlib库
cd /usr/local/src/zlib-1.2.11
构建静态库
.../zlib-1.2.11]# ./configure
.../zlib-1.2.11]# make test
.../zlib-1.2.11]# make install
构建共享库
.../zlib-1.2.11]# make clean
.../zlib-1.2.11]# ./configure --shared
.../zlib-1.2.11]# make test
.../zlib-1.2.11]# make install
.../zlib-1.2.11]# cp zutil.h /usr/local/include
.../zlib-1.2.11]# cp zutil.c /usr/local/include
2、重新升级openssl
① 编译安装
cd /usr/local/src/openssl-1.1.1h/
./config shared zlib
make && make install
发现报错 undefined reference to `BIO_f_zlib’
缺少zlib.h文件
解决报错方法:
make clean
make //重新编译
# 再次编译安装 openssl
cd /usr/local/src/openssl-1.1.1h/
./config shared zlib
make && make install
配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak # 如报mv: cannot stat ‘/usr/include/openssl’: No such file or directory可忽略此步
find / -name openssl
ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl /usr/include/openssl
echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig
openssl version -a
结果验证
执行openssl version 发现openssl版本已是最新版本
解决方案简化
一、zlib源码安装步骤:
cd /usr/local/src/zlib-1.2.11
构建静态库
.../zlib-1.2.11]# ./configure
.../zlib-1.2.11]# make test
.../zlib-1.2.11]# make install
构建共享库
.../zlib-1.2.11]# make clean
.../zlib-1.2.11]# ./configure --shared
.../zlib-1.2.11]# make test
.../zlib-1.2.11]# make install
.../zlib-1.2.11]# cp zutil.h /usr/local/include
.../zlib-1.2.11]# cp zutil.c /usr/local/include
二、单独升级openssl
编译安装
cd /usr/local/src/openssl-1.1.1h/
make clean //清除上次的make命令所产生的object文件
make //重新编译
./config shared zlib
make && make install
配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak # 如报mv: cannot stat ‘/usr/include/openssl’: No such file or directory可忽略此步
find / -name openssl
ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl /usr/include/openssl
echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig
openssl version -a
#!/bin/bash
cd /usr/local/src/zlib-1.2.11
#构建静态库
./configure
make test
make install
#构建共享库
make clean
./configure --shared
make test
make install
cp zutil.h /usr/local/include
cp zutil.c /usr/local/include
#二、单独升级openssl
#编译安装
cd /usr/local/src/openssl-1.1.1h/
make clean //清除上次的make命令所产生的object文件
make //重新编译
./config shared zlib
make && make install
#配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak # 如报mv: cannot stat ‘/usr/include/openssl’: No such file or directory可忽略此步
find / -name openssl
ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl /usr/include/openssl
echo "/usr/local/lib64/" >> /etc/ld.so.conf
ldconfig
openssl version -a