1.下載
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
2.解壓
tar -xf openssl-1.0.2o.tar.gz
cd openssl-1.0.2o/
3.安裝
yum remove -y openssl-devel
yum install -y zlib perl
./config --prefix=/usr/local/openssl shared zlib
make depend
make && make install
4.備份
mv /usr/bin/openssl /root/openssl
mv /usr/include/openssl/ /usr/include/openssl_bak
5.配置
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
ldconfig -v
ln -s /usr/local/openssl/bin/openssl /usr/bin/
ln -s /usr/local/openssl/include/openssl/ /usr/include/
6.測試
#openssl version
OpenSSL 1.0.2o 27 Mar 2018
7.報錯解決
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
openssl: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1