### 设置环境变量
version=1.1.1e
url=https://www.openssl.org
install_path=/opt/openssl-${version}
安装依赖
yum install -y perl perl-devel gcc gcc-c++ perl-Test-Simple
下载并编译
wget ${url}/source/openssl-${version}.tar.gz
tar xf openssl-${version}.tar.gz
cd openssl-${version}
./config shared \
--openssldir=${install_path} \
--prefix=${install_path}
make && make install
替换旧版本
mv /usr/bin/openssl /usr/bin/openssl_$(date +%-F)
ln -s ${install_path}/bin/openssl /usr/bin/openssl
默认路径(不指定编译路径的情况):/usr/local/bin/openssl
配置动态库
方法一
echo "${install_path}/lib/" >> /etc/ld.so.conf
ldconfig
方法二
ln -s ${install_path}/lib/libssl.so.1.1 /usr/lib64/
ln -s ${install_path}/lib/libcrypto.so.1.1 /usr/lib64/
默认路径(不指定编译路径的情况): /usr/local/lib64/
评论区