1、yum原生安装openssl
yum update
yum install openssl
2、源码编译安装openssl
以下均以 root 身份运行Shell。
1. 安装所需的编译器和工具:
yum group install 'Development Tools' yum install perl-core zlib-devel -y git 2. 从github上下载最新的OpenSSL cd /usr/local/src git clone https://github.com/openssl/openssl.git
3. 编译OpenSSL
cd openssl ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib make make test make install
4. 配置 Link Libraries
cd /etc/ld.so.conf.d/ vi openssl-3.0.0-dev.conf 将下面的内容写进去: /usr/local/ssl/lib
5. 重载动态Link
ldconfig -v
6. 备份
mv /usr/bin/openssl /usr/bin/openssl.backup
7. 为OpenSSL创建新的环境
vi /etc/profile.d/openssl.sh 将下面的内容写进去: #Set OPENSSL_PATH OPENSSL_PATH=/usr/local/ssl/bin export OPENSSL_PATH PATH=$PATH:$OPENSSL_PATH export PATH 最后一部份工作: chmod +x /etc/profile.d/openssl.sh source /etc/profile.d/openssl.sh echo $PATH which openssl
8. 测试
openssl version -a