安装 OpenSSL

安装 OpenSSL  按照基本的安装方法(yum、apt 等)安装就好了,网上也有很多高版本的安装方法,这里就不做探讨了,一搜一大把

安装 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

查看版本信息

[root@localhost GmSSL-master]# gmssl version -a

GmSSL 2.5.4 - OpenSSL 1.1.0d 19 Jun 2019

built on: reproducible build, date unspecified

platform: linux-x86_64

compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DGMI_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/gmssl/ssl\"" -DENGINESDIR="\"/usr/local/gmssl/lib/engines-1.1\"" -Wa,--noexecstack

OPENSSLDIR: "/usr/local/gmssl/ssl"

ENGINESDIR: "/usr/local/gmssl/lib/engines-1.1"

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐