Ubuntu下升级OpenSSL 0.9.8e版本至OpenSSL 1.1.1v版本
一、安装方法
//源码压缩包资源在本文件夹中查找,安装步骤:
[root@localhost openssl]# tar -zxvf openssl-1.1.1v.tar.gz
[root@localhost openssl]# cd openssl-1.1.1v
如果本地已经安装过OpenSSL则需要先备份旧版本的OpenSSL,一般默认安装的库都在"/usr/bin/"目录下。
[root@localhost openssl]# find / -name openssl
#1.通过命令查询以及确认可得/usr/bin/目录下的openssl为当前的旧版本(确认方法,进入/usr/bin/目录后执行"./openssl version"后返回openssl版本号)。
/usr/bin/openssl
/usr/lib/openssl
/usr/lib64/openssl
/usr/include/openssl
/home/openssl
#2.备份原OpenSSL
[root@localhost openssl]# mv /usr/bin/openssl /usr/bin/openssl.bak
#3.执行命令,用以生成OpenSSL编译使用的MakeFile文件
[root@localhost openssl]# ./config shared --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
遇到的问题
- 当我解压缩源码并进入解压后的文件夹内后执行 " ./Configure shared --prefix=/usr/local/openssl --openssldir=/usr/local/openssl " 时出现错误,错误描述如下:
[root@localhost openssl]# ./config shared --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
Operating system: x86_64-whatever-linux2
Perl v5.10.0 required--this is only v5.8.8, stopped at ./Configure line 12.
BEGIN failed--compilation aborted at ./Configure line 12.
Perl v5.10.0 required--this is only v5.8.8, stopped at ./Configure line 12.
BEGIN failed--compilation aborted at ./Configure line 12.
This system (linux-x86_64) is not supported. See file INSTALL for details.
[root@localhost openssl]#
- 问题描述:这个问题告诉我们,当前我的perl库版本为5.8.8,但安装OpenSSL需要perl库版本至少为5.10.0,解决这个问题只能尝试升级本地旧的perl库,请查阅另一篇文章Perl库由5.8.8版本升级至5.10.0版本以进行升级,如果没有遇到这个问题,可以直接跳过perl升级步骤。
perl库升级完成后,重新安装OpenSSL,执行上个命令 " ./config shared --prefix=/usr/local/openssl --openssldir=/usr/local/openssl "
[root@localhost openssl]# ./config shared --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1v (0x1010116fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
[root@localhost openssl]#
#生成makefile文件成功,准备编译安装过程
二、编译安装
#4.使用以下命令进行编译安装过程
[root@localhost openssl]# make && make install
#5.#创建软链接到系统位置
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
#6.测试OpenSSL是否升级成功
[root@localhost bin]# ./openssl
OpenSSL>
[root@localhost bin]# openssl version
OpenSSL 1.1.1v 1 Aug 2023
# 可以看到OpenSSL版本已升级到1.1.1v版本