升级OpenSSL

目录大纲

  • 1.下载解压源码包
  • 2.配置编译安装OpenSSL
  • 3.设置默认使用新版本OpenSSL

OpenSSL 官网:https://www.openssl.org

1.下载解压源码包

下载新版本源码包,并解压:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
root@xsy ~]# cd /usr/local/src
[root@xsy src]#wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz
[root@xsy src]# tar -zxf openssl-1.0.2j.tar.gz
[root@xsy src]# ls
openssl-1.0.2j openssl-1.0.2j.tar.gz
[root@xsy src]# cd openssl-1.0.2j/
[root@xsy openssl-1.0.2j]# ls
ACKNOWLEDGMENTS demos INSTALL.DJGPP Makefile.bak README
apps doc INSTALL.MacOS Makefile.org README.ASN1
appveyor.yml engines INSTALL.NW Makefile.shared README.ENGINE
bugs e_os2.h INSTALL.OS2 makevms.com shlib
certs e_os.h INSTALL.VMS ms ssl
CHANGES FAQ INSTALL.W32 Netware test
CHANGES.SSLeay GitConfigure INSTALL.W64 NEWS tools
config GitMake INSTALL.WCE openssl.doxy util
Configure include LICENSE openssl.spec VMS
CONTRIBUTING INSTALL MacOS os2
crypto install.com Makefile PROBLEMS

2.配置编译安装OpenSSL

1
2
3
4
5
6
7
8
9
10
[root@xsy openssl-1.0.2j]# ./config shared zlib
[root@xsy openssl-1.0.2j]# make && make install
...省略...
cp libcrypto.pc /usr/local/ssl/lib/pkgconfig
chmod 644 /usr/local/ssl/lib/pkgconfig/libcrypto.pc
cp libssl.pc /usr/local/ssl/lib/pkgconfig
chmod 644 /usr/local/ssl/lib/pkgconfig/libssl.pc
cp openssl.pc /usr/local/ssl/lib/pkgconfig
chmod 644 /usr/local/ssl/lib/pkgconfig/openssl.pc
# 看到安装到 /usr/local/ssl 下了

3.设置默认使用新版本OpenSSL

  • 备份老版本 OpenSSL

    1
    2
    [root@xsy openssl-1.0.2j]# mv /usr/bin/openssl /usr/bin/openssl.old
    [root@xsy openssl-1.0.2j]# mv /usr/include/openssl/ /usr/include/openssl.old
  • 设置默认使用新版本

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    [root@xsy openssl-1.0.2j]# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
    [root@xsy openssl-1.0.2j]# ln -s /usr/local/ssl/include/openssl/ /usr/include/openssl
    [root@xsy openssl-1.0.2j]# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
    [root@xsy openssl-1.0.2j]# ldconfig -v
    [root@xsy openssl-1.0.2j]# cat /etc/ld.so.conf
    include ld.so.conf.d/*.conf
    /lib
    /usr/lib
    /usr/lib64
    /usr/local/lib
    /usr/local/ssl/lib
    [root@xsy openssl-1.0.2j]# openssl version
    OpenSSL 1.0.2j 26 Sep 2016

    # 查看当前版本
    [root@xsy ~]# openssl version
    OpenSSL 1.0.2j 26 Sep 2016
    [root@xsy ~]#

The end!

文章目录
  1. 目录大纲
  2. 1.下载解压源码包
  3. 2.配置编译安装OpenSSL
  4. 3.设置默认使用新版本OpenSSL