阅读目录
- 1. Linux 系统版本:
- 2. 查看Openssl安装的版本
- 3. 查看Openssl路径
- 4.下载Openssl
- 5. 安装依赖
- 6. 安装Perl
- 7. 安装Openssl
- 8.更新动态链接库数据
- 9.重新加载动态链接库
- 10.查看安装完成后的最新版本
- 11.可能存在的异常
参考链接,复制过来的知乎一个博主的,可能知乎对链接做了些限制,导致不好复制,这里也正好再复习一遍:Openssl升级操作 - 知乎
1. Linux 系统版本:
[root@zhizuo opt]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
2. 查看Openssl安装的版本
[root@zhizuo opt]# openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017 (Library: OpenSSL 1.0.2o-fips 27 Mar 2018)
3. 查看Openssl路径
[root@zhizuo opt]# which openssl
/usr/bin/openssl
4.下载Openssl
目前最新版本是1.1.1,可以通过修改版本号的方式下载最新版本,最新版本可以在这个网站下载:https://www.openssl.org/source
[root@zhizuo opt]# wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1b.tar.gz --no-check-certificate
--2022-06-10 23:30:43-- https://www.openssl.org/source/old/1.1.1/openssl-1.1.1b.tar.gz
Resolving www.openssl.org (www.openssl.org)... 125.56.145.176, 2600:1417:e800:186::c1e, 2600:1417:e800:182::c1e
Connecting to www.openssl.org (www.openssl.org)|125.56.145.176|:443... connected.
WARNING: cannot verify www.openssl.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 8213737 (7.8M) [application/x-gzip]
Saving to: ‘openssl-1.1.1b.tar.gz’
100%[=================================================================================================>] 8,213,737 208KB/s in 22s
2022-06-10 23:31:07 (370 KB/s) - ‘openssl-1.1.1b.tar.gz’ saved [8213737/8213737]
5. 安装依赖
[root@bogon ~]# yum install -y zlib
[root@bogon ~]# yum install –y zlib-devel
[root@bogon ~]# yum install –y gcc
6. 安装Perl
6.1下载Perl
官方网站下载新版本的源码包:http://www.perl.org/get.html
[root@zhizuo opt]# wget https://www.cpan.org/src/5.0/perl-5.28.2.tar.gz --no-check-certificate
--2022-06-10 23:36:22-- https://www.cpan.org/src/5.0/perl-5.28.2.tar.gz
Resolving www.cpan.org (www.cpan.org)... 151.101.109.55, 2a04:4e42:1a::311
Connecting to www.cpan.org (www.cpan.org)|151.101.109.55|:443... connected.
WARNING: cannot verify www.cpan.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 17715666 (17M) [application/x-gzip]
Saving to: ‘perl-5.28.2.tar.gz’
100%[=================================================================================================>] 17,715,666 508KB/s in 1m 41s
2022-06-10 23:38:03 (171 KB/s) - ‘perl-5.28.2.tar.gz’ saved [17715666/17715666]
6.2 解压Perl
[root@zhizuo opt]# tar -zxvf perl-5.28.2.tar.gz
6.3建立文件目录,以供安装时使用
[root@zhizuo opt]# mkdir /usr/local/perl
6.4配置Perl参数
进入perl-5.28.2.tar.gz的解压目录,执行:
[root@zhizuo opt]# cd perl-5.28.2
[root@zhizuo perl-5.28.2]# ./Configure -des -Dprefix=/usr/local/perl -Dusethreads –Uversiononly
6.5 编译
[root@zhizuo perl-5.28.2]# make
6.6安装
[root@zhizuo perl-5.28.2]# make install
6.7查看版本
[root@zhizuo perl-5.28.2]# perl -v
7. 安装Openssl
7.1解压Openssl
[root@zhizuo opt]# tar -zxvf openssl-1.1.1b.tar.gz
7.2调用zlib共享库
[root@zhizuo opt]# cd openssl-1.1.1b
[root@zhizuo openssl-1.1.1b]# ./config shared zlib
7.3编译
[root@zhizuo openssl-1.1.1b]# make
7.4安装
[root@zhizuo openssl-1.1.1b]# make install
7.5备份当前Openssl
[root@zhizuo openssl-1.1.1b]# mv /usr/bin/openssl /usr/bin/openssl.old
[root@zhizuo openssl-1.1.1b]# mv /usr/lib64/openssl /usr/lib64/openssl.old
7.6使用新版Openssl
[root@zhizuo openssl-1.1.1b]# ln -s /usr/local/bin/openssl /usr/bin/openssl
[root@zhizuo openssl-1.1.1b]# ln -s /usr/local/include/openssl/ /usr/include/openssl
8.更新动态链接库数据
[root@zhizuo openssl-1.1.1b]# echo "/usr/local/lib/" >> /etc/ld.so.conf
9.重新加载动态链接库
[root@bogon openssl-1.1.1b]# ldconfig -v
10.查看安装完成后的最新版本
[root@zhizuo openssl-1.1.1b]# openssl version
OpenSSL 1.1.1b 26 Feb 2019
[root@zhizuo openssl-1.1.1b]# openssl version -a
11.可能存在的异常
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
这是由于openssl库的位置不正确造成的。
解决方法:
在root用户下执行:
[root@zhizuo openssl-1.1.1b]# ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[root@zhizuo openssl-1.1.1b]# ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
参考文章: