gmssl编译安装过程,避免与服务器已安装的openssl冲突

1、登录服务器,从Git上把源码拿下来:

git clone git://github.com/guanzhi/GmSSL.git

$ git clone git://github.com/guanzhi/GmSSL.git
正克隆到 'GmSSL'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 15804 (delta 0), reused 0 (delta 0), pack-reused 15802
接收对象中: 100% (15804/15804), 36.80 MiB | 5.14 MiB/s, 完成.
处理 delta 中: 100% (9244/9244), 完成.
$ 

2、修改Makefile.shared文件中的soname参数变量值:

DO_GNU_SO_COMMON=\
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=libgm$(LIBNAME)$$SHLIB_SOVER$$SHLIB_SUFFIX"

3、按照官网说明进行编译安装:

http://gmssl.org/docs/install.html

$ ./config  --prefix=/usr/local --openssldir=/usr/local/ssl
$ sudo make
$ sudo make install
$ openssl version
openssl: error while loading shared libraries: libgmssl.1.1: cannot open shared object file: No such file or directory
$ gmssl version
gmssl: error while loading shared libraries: libgmssl.1.1: cannot open shared object file: No such file or directory

a、此时发现openssl和gmssl加载不到依赖包。

4、重新编译openssl并安装:

#./config shared --prefix=/usr/local --openssldir=/usr/local/ssl
#make && make install
# openssl version
OpenSSL 1.1.0d  26 Jan 2017

# gmssl version
gmssl: error while loading shared libraries: libgmssl.1.1: cannot open shared object file: No such file or directory

b、解决了openssl的问题

5、查看gmssl安装路径并拷贝so文件到依赖包文件夹下:

# ldd /usr/local/bin/gmssl
        linux-vdso.so.1 (0x00007ffc9a9b3000)
        libgmssl.1.1 => not found
        libgmcrypto.1.1 => not found
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdf82142000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdf81d51000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fdf8261d000)

# cp libcrypto.so.1.1 /usr/local/lib/libgmcrypto.1.1
# cp libssl.so.1.1 /usr/local/lib/libgmssl.1.1

6、gmssl 找不到链接库:

/etc/ld.so.conf.d/路径下配置链接库路径,然后重新执行ldconfig

# gmssl version
gmssl: error while loading shared libraries: libgmssl.1.1: cannot open shared object file: No such file or directory

# cd /etc/ld.so.conf.d/

# more openssl-1.1.0d.conf 
/usr/local/ssl/lib

7、重启服务器即可:

reboot命令重启服务器即可:

# gmssl version
GmSSL 2.5.4 - OpenSSL 1.1.0d  3 Sep 2019
# openssl version
OpenSSL 1.1.0d  26 Jan 2017

完~

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值