升级openssl

openssl版本一键升级(需要修改tar包名称和路径)

---
- name: Install OpenSSL
  hosts: openssl
  tasks:
    - name: Copy OpenSSL tar.gz to /tmp
      copy:
        src: /root/shl/soft/openssl-1.1.1v.tar.gz
        dest: /tmp
#        remote_src: yes  # 如果源文件在控制主机上

    - name: Extract OpenSSL tar.gz
      command: tar -zxvf /tmp/openssl-1.1.1v.tar.gz
      args:
        chdir: /tmp
      become: yes

    - name: Configure OpenSSL
      command: ./config --prefix=/usr/local/openssl
      args:
        chdir: /tmp/openssl-1.1.1v
      #become: yes

    - name: Build and make OpenSSL
      command: make 
      args:
        chdir: /tmp/openssl-1.1.1v
      #become: yes
    - name: Build and make install OpenSSL
      command:  make install
      args:
        chdir: /tmp/openssl-1.1.1v

    - name: Backup existing openssl binary
      command: mv /usr/bin/openssl /usr/bin/openssl.bak
      #become: yes

    - name: Create symlink to the new OpenSSL
      command: ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
      #become: yes

    - name: Verify OpenSSL version
      command: openssl version
      register: openssl_version
      become: yes

    - name: Display OpenSSL version
      debug:
        var: openssl_version.stdout_lines

如果出现 openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory ,缺少相关库依赖,检查库文件
解决办法:

ln -s /usr/local/openssl/lib64/libssl.so.3 /usr/lib64/libssl.so.3
ln -s /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3

查看版本

openssl version
  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值