CentOS7编译安装OpenSSL3.1

CentOS7编译安装OpenSSL3.1

1.下载Openssl源码包

官网:OpenSSL

[root@localhost ~]# wget https://www.openssl.org/source/openssl-3.1.0.tar.gz

2.解压安装

[root@localhost ~]# tar -xvf openssl-3.1.0.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/openssl-3.1.0/
[root@localhost openssl-3.1.0]# ./config --prefix=/usr/local/openssl

如果报错为: 缺少IPC/Cmd.pm模块

[root@localhost openssl-3.1.0]# ./config  --prefix=/usr/local/openssl
Can't locate IPC/Cmd.pm in @INC (@INC contains: /root/Downloads/openssl-3.1.0/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /root/Downloads/openssl-3.1.0/external/perl/Text-Template-1.56/lib) at /root/Downloads/openssl-3.1.0/util/perl/OpenSSL/config.pm line 18.
BEGIN failed--compilation aborted at /root/Downloads/openssl-3.1.0/util/perl/OpenSSL/config.pm line 18.
Compilation failed in require at /root/Downloads/openssl-3.1.0/Configure line 23.
BEGIN failed--compilation aborted at /root/Downloads/openssl-3.1.0/Configure line 23.

解决方法:

[root@localhost openssl-3.1.0]# yum -y install perl-IPC-Cmd

3.重新编译配置:

[root@localhost openssl-3.1.0]# ./config  --prefix=/usr/local/openssl
[root@localhost openssl-3.1.0]# make -j 32
[root@localhost openssl-3.1.0]# make install

libssl.so.3文件在/usr/local/openssl/lib64目录下面,需要配置到共享库中:

[root@localhost ~]# vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/openssl/lib64

加载生效:
[root@localhost ~]# ldconfig

做软连接:

[root@localhost ~]# mv /usr/bin/openssl /usr/bin/openssl.bak
[root@localhost ~]# mv /usr/include/openssl /usr/include/openssl.bak 

[root@localhost ~]# ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
[root@localhost ~]# ln -s /usr/local/openssl/include/openssl/  /usr/include/openssl

查看Openssl版本:

[root@localhost ~]# openssl version
OpenSSL 3.1.0 14 Mar 2023 (Library: OpenSSL 3.1.0 14 Mar 2023)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值