Article directory
openssl download & unzip
or https://www.openssl.org/source/openssl-1.1.1l.tar.gz
upload to server
decompress
tar -zxvf openssl-1.1.1l.tar.gz
Switch to the openssl-1.1.1l directory
cd openssl-1.1.1l
Specify the installation path
#./config --prefix=/your/path/to/openssl-1.1.1l no-zlib #Pay attention to add no-zlib
mkdir ~/include # Create if there is no include folder in the root directory, the path here is custom Yes, it doesn’t have to be
this./config --prefix=~/include no-zlib
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1t (0x1010114fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** 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 file first) ***
*** ***
**********************************************************************
Compile and install
make -j && make install
Configure environment variables
Because it is a non-Root installation, in order to find the openssl library when compiling the c++ program, you need to manually add include_path
Add the following configuration to the .bashrc file. Note: When I was configuring, I copied and pasted the source directly and it did not take effect. The reason for troubleshooting should be an input problem. After typing it by hand, the source successfully took effect. Chinese notes.
vim .bashrc
#在PATH中找到可执行文件程序的路径。
export PATH ="~/include/openssl-1.1.1l/bin:$PATH"
#gcc找到头文件的路径
export C_INCLUDE_PATH="~/include/openssl-1.1.1l/include:$C_INCLUDE_PATH"
#g++找到头文件的路径
export CPLUS_INCLUDE_PATH="~/include/openssl-1.1.1l/include:$CPLUS_INCLUDE_PATH"
#找到动态链接库的路径
export LD_LIBRARY_PATH="~/include/openssl-1.1.1l/lib:$LD_LIBRARY_PATH"
#找到静态库的路径
export LIBRARY_PATH="~/include/openssl-1.1.1l/lib:$LIBRARY_PATH"
source .bashrc
Verify that the installation was successful
openssl version -a
If it is installed correctly, it will display the path information specified by itself.
OpenSSL 1.1.1t 7 Feb 2023
built on: Sat May 20 08:20:50 2023 UTC
platform: linux-x86_64
options: bn(64,64) rc4(8x,int) des(int) idea(int) blowfish(ptr)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -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 -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
OPENSSLDIR: "/yourpath/01_develop_tools/openssl_libssl-dev/ssl"
ENGINESDIR: "/yourpath/01_develop_tools/openssl_libssl-dev/lib/engines-1.1"