wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1.tar.gz
tar -zxvf openssl-1.1.1.tar.gz
cd openssl-1.1.1
编译代码,安装到/usr/include/openssl
./config -fPIC --prefix=/usr/include/openssl enable-shared
make
make install
[root@zbpt2-82 openssl-3.2.1]# ./config -fPIC --prefix=/usr/include/openssl enable-shared
Configuring OpenSSL version 3.2.1 for target linux-x86_64
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created Makefile.in
Created Makefile
Created include/openssl/configuration.h
**********************************************************************
*** ***
*** 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.md file first) ***
*** ***
*********************************************************************
切换openssl版本
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -s /usr/include/openssl/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3ln -s /usr/include/openssl/lib64/libssl.so.3 /usr/lib64/libssl.so.3
ln -s /usr/include/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/include/openssl/include/openssl /usr/include/openssl
echo "/usr/include/openssl/lib64" >> /etc/ld.so.conf
ldconfig -v
ln -s /usr/include/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
验证版本:
openssl version -a
[root@zbpt2-82 bin]# openssl version -a
OpenSSL 1.1.1s 1 Nov 2022
built on: Fri May 17 11:57:31 2024 UTC
platform: linux-x86_64
options: bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -fPIC -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 -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
OPENSSLDIR: "/usr/include/openssl/ssl"
ENGINESDIR: "/usr/include/openssl/lib/engines-1.1"
Seeding source: os-specific
如需使用新版本开发,则需替换原来的软链接指向,即替换原动态库,进行版本升级。
替换/lib(lib64)和/usr/lib(lib64)和/usr/local/lib(lib64)存在的相应动态库: