------------ ------------ CentOS7 默认提供的openssl版本是1.0.2的,想要升级openssl版本则需要手动进行编译 # 一、准备工作 ```shell yum install -y gcc ``` make时需要gcc编译环境,不然就会有如下报错: ```shell [root@192-168-1-33 openssl-1.1.1d]# make /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ "-oMakefile" crypto/include/internal/bn_conf.h.in > crypto/include/internal/bn_conf.h /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ "-oMakefile" crypto/include/internal/dso_conf.h.in > crypto/include/internal/dso_conf.h /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h make depend && make _all make[1]: Entering directory `/root/openssl-1.1.1d' make[1]: Leaving directory `/root/openssl-1.1.1d' make[1]: Entering directory `/root/openssl-1.1.1d' gcc -I. -Iinclude -fPIC -pthread -m64 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib64/engines-1.1\"" -DNDEBUG -c -o apps/app_rand.o apps/app_rand.c /bin/sh: gcc: command not found make[1]: *** [apps/app_rand.o] Error 127 make[1]: Leaving directory `/root/openssl-1.1.1d' make: *** [all] 错误 2 [root@192-168-1-33 openssl-1.1.1d]# ``` # 二、下载openssl-1.1.1 ```shell wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz --no-check-certificate tar zxvf openssl-1.1.1d.tar.gz ``` # 三、编译openssl ```shell cd openssl-1.1.1d/ ./config make make install ``` # 四、配置 注意:默认编译后,查看当前openssl版本号时,你会发现还是1.0.2,所以这里需要做一些额外的配置工作 ```shell [root@192-168-1-33 openssl-1.1.1d]# openssl version openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory [root@192-168-1-33 openssl-1.1.1d]# ``` ```shell echo "/usr/local/lib64/" >> /etc/ld.so.conf ldconfig mv /usr/bin/openssl /usr/bin/openssl.old ln -sv /usr/local/bin/openssl /usr/bin/openssl ``` # 五、验证 ```shell [root@192-168-1-33 openssl-1.1.1d]# openssl version OpenSSL 1.1.1d 10 Sep 2019 [root@192-168-1-33 openssl-1.1.1d]# ``` 最后修改:2022 年 05 月 14 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏