OpenSSL 的安装方法网上已经很多资料,所以这里直接介绍GMSSL的安装方法(保留原始的 OpenSSL)
下载 GMSSL 安装包
# 下载 gmssl
wget https://github.com/guanzhi/GmSSL/archive/master.zip
# 解压
unzip master.zip
编译
cd GmSSL-master
# --prefix 指定 gmssl 的安装路径
# --openssldir 表示 OpenSSL 数据区域,例如openssl.cnf,证书和密钥. 如果是相对目录,它将被添加到--prefix给定的目录中。【可以不指定,默认在 --prefix 同级目录的 ssl 目录】
# no-shared 表示只编译静态库,不编译动态库
#
# 官方解释
#
# --prefix prefix for the OpenSSL installation, which includes the
# directories bin, lib, include, share/man, share/doc/openssl
# This becomes the value of INSTALLTOP in Makefile
# (Default: /usr/local)
# --openssldir OpenSSL data area, such as openssl.cnf, certificates and keys.
# If it's a relative directory, it will be added on the directory
# given with --prefix.
# This becomes the value of OPENSSLDIR in Makefile and in C.
# (Default: PREFIX/ssl)
# [no-]shared [don't] try to create shared libraries when supported.
./config --prefix=/usr/local/gmssl no-shared
安装
make
# 安装(如果有旧版本,可以使用 make uninstall 卸载,然后删除对应文件)
make install
添加环境变量
# 添加环境变量
echo 'export PATH="$PATH:/usr/local/gmssl/bin"' >> ~/.bash_profile
source ~/.bash_profile
评论区