參考鏈接
- 編譯與安裝
- 【GmSSL】GmSSL 與 OpenSSL 共存的安裝方法_阿卡基YUAN的博客-CSDN博客_openssl和gmssl
- 在Linux下安裝GmSSL_百里楊的博客-CSDN博客_安裝gmssl
ubuntu18操作
- 需要超級管理員權限
- 本人將下載的安裝包master.zip和安裝的位置都設定在/usr/local下
- 創建文件夾/usr/local/gmssl,用于后期安裝gmssl
# 下載 gmssl
wget https://github.com/guanzhi/GmSSL/archive/master.zip
# 解壓
unzip master.zip
- 配置安裝路徑,編譯為靜態庫
- cd GmSSL-master/ 進入解壓后的文件夾
- 注:–prefix表示安裝路徑;no-shared 表示只編譯靜態庫;默認生成64位庫。
- ./config --prefix=/usr/local/gmssl --openssldir=/usr/local/gmssl no-shared
- 編譯
- sudo make
- 安裝
- sudo make install
- 添加環境變量
# 添加環境變量
echo 'export PATH="$PATH:/usr/local/gmssl/bin"' >> ~/.bash_profile
source ~/.bash_profile
- 查看版本信息(openssl 與 gmssl共存)
??
ubuntu20操作
- ?ubuntu18按照上述操作是沒有問題的,但是在ubuntu20上還需要進一步修改
- 參考鏈接??????Ubuntu20上編譯Gmssl庫并使用Java調用其提供的Java Wapper API接口_EEEEEEcho的博客-CSDN博客_gmssl java
- 在執行./config之前需要執行?需要修改兩個文件才能編譯通過
- 修改Configure文件 sudo gedit??Configure
- 這個在前15行找
- 原文? use if $^O ne "VMS", 'File::Glob' => qw/glob/;
- 修改后?use if $^O ne "VMS", 'File::Glob' => qw/:glob/;
- 即 在?qw/和glob/之間插入冒號
- 修改?test/build.info 文件?? sudo gedit ./test/build.info
- 這個在后15行找
- 原文?use if $^O ne "VMS", 'File::Glob' => qw/glob/;
- 修改后?use if $^O ne "VMS", 'File::Glob' => qw/:glob/;
- 即 在?qw/和glob/之間插入冒號
完整流程
- 解壓文件
- 進入解壓后的文件
- 修改文件 Configure 和? ./test/build.info
- 設置參數,生成make文件的目標文件
- ./config --prefix=/usr/local/gmssl --openssldir=/usr/local/gmssl no-shared
- 注:–prefix表示安裝路徑;no-shared 表示只編譯靜態庫;默認生成64位庫
- 編譯
- sudo make
- make test ubuntu18不會出現問題,但是ubuntu20會顯示 2個Error,這個對于后面的make install進行安裝沒有任何影響
- 安裝
- sudo make install
- ?添加環境變量
- 也可以將其添加到為~/.bashrc
- 技術|什么是 .bashrc,為什么要編輯 .bashrc?
# 添加環境變量
echo 'export PATH="$PATH:/usr/local/gmssl/bin"' >> ~/.bash_profile
source ~/.bash_profile
- 查看版本信息(openssl 與 gmssl共存)
補充說明
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.