安裝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共存)

世界微塵里,吾寧愛與憎。
