GmSSL 与 OpenSSL 共存的安装方法

安装openssl

使用yum或者apt命令都可以安装,现在最新的系统自带的就是openssl1.1.1g

安装 GmSSL

关键点就是no-shared:只编译静态库

下载解压

# 下载 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

查看版本信息(openssl 与 gmssl共存)

                                                              世界微尘里,吾宁爱与憎。

原文地址:https://www.cnblogs.com/marshu/p/14201324.html