适用于 Ubuntu 14.04/16.04 系统
**移除旧版 OpenSSL**
sudo apt-get remove openssl
**下载 OpenSSL 最新源码**
sudo wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
**解压源码包**
sudo tar -zxvf openssl-1.1.0f.tar.gz
**进入源码目录**
sudo cd openssl-1.1.0f/
**配置编译选项**
sudo ./config shared --prefix=/usr/local/openssl --openssldir=/usr/lib/openssl
**编译并安装**
sudo make && sudo make install
**设置环境变量**
使用文本编辑器打开 ~/.bashrc 文件:
sudo vim ~/.bashrc
在文件末尾添加以下行,然后保存并关闭文件:
export PATH=$PATH:/usr/local/openssl/bin
**使环境变量生效**
sudo source ~/.bashrc
**创建符号链接**
sudo ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib/libssl.so.1.1 sudo ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1
**验证 OpenSSL 版本**
openssl version
预期输出:
OpenSSL 1.1.0f 25 May 2017
this revised answer maintains the original image and its format, rewords the instructions slightly for clarity and flow, and uses consistent code block formatting. The changes are subtle but improve readability.