环境信息
CentOS Linux release 7.6.1810 (Core);
OpenSSL 1.1.1l 24 Aug 2021
依赖
yum -y install perl perl-devel gcc gcc-c++
升级
查看当前版本
[michael@centos7 src]$ openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
下载最新版本
请到下面页面下载。
官网下载地址: https://www.openssl.org/source/
Github地址:https://github.com/openssl/openssl/releases
[michael@centos7 src]$ wget https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1l.tar.gz
[michael@centos7 src]$ tar xzvf ./openssl-OpenSSL_1_1_1l.tar.gz
[michael@centos7 src]$ cd openssl-OpenSSL_1_1_1l/
接下来执行编译操作,
[michael@centos7 openssl-OpenSSL_1_1_1l]$ ./config
如果没有安装Perl 5,执行config会有提示没有安装,需要先进行安装,执行
yum install perl
接下来依次执行下面的命令:
[michael@centos7 openssl-OpenSSL_1_1_1l]$ make
[michael@centos7 openssl-OpenSSL_1_1_1l]$ make test
[michael@centos7 openssl-OpenSSL_1_1_1l]$ make install
替换新旧版本:
[michael@centos7 src]$ mv /usr/bin/openssl /usr/bin/oldopenssl
[michael@centos7 src]$ ln -s /usr/local/bin/openssl /usr/bin/openssl
如果执行openssl version报下面错误,
[inspur@localhost openssl-OpenSSL_1_1_1c]$ openssl version
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
则执行下面命令解决:
[michael@centos7 src]$ ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/
[michael@centos7 src]$ ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/
然后查看当前版本:
michael@centos7 openssl-OpenSSL_1_1_1c]$ openssl version
OpenSSL 1.1.1l 24 Aug 2021
常见错误
错误:begin failed–compilation aborted at .././test/run_tests.pl
解决:sudo yum install perl-devel
错误:Parse errors: No plan found in TAP output
解决:yum install perl-Test-Simple