此文檔提供方法爲官方源碼build成rpm後,用rpm進行升級,在Centos7.5.1804下實現,其餘環境未經測試(南網數據庫環境爲7.5.1804)。node
1, 數據庫
#下面內容可拷貝成腳本執行 #!/bin/bash set -e set -v mkdir ~/openssl && cd ~/openssl yum -y install \ curl \ which \ make \ gcc \ perl \ perl-WWW-Curl \ rpm-build # Get openssl tarball cp /root/openssl-1.1.1i.tar.gz ./ # SPEC file cat << 'EOF' > ~/openssl/openssl.spec Summary: OpenSSL 1.1.1i for Centos Name: openssl Version: %{?version}%{!?version:1.1.1i} Release: 1%{?dist} Obsoletes: %{name} <= %{version} Provides: %{name} = %{version} URL: https://www.openssl.org/ License: GPLv2+ Source: https://www.openssl.org/source/%{name}-%{version}.tar.gz BuildRequires: make gcc perl perl-WWW-Curl BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %global openssldir /usr/openssl %description OpenSSL RPM for version 1.1.1i on Centos %package devel Summary: Development files for programs which will use the openssl library Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel OpenSSL RPM for version 1.1.1i on Centos (development package) %prep %setup -q %build ./config --prefix=%{openssldir} --openssldir=%{openssldir} make %install [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} %make_install mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_libdir} ln -sf %{openssldir}/lib/libssl.so.1.1 %{buildroot}%{_libdir} ln -sf %{openssldir}/lib/libcrypto.so.1.1 %{buildroot}%{_libdir} ln -sf %{openssldir}/bin/openssl %{buildroot}%{_bindir} %clean [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} %files %{openssldir} %defattr(-,root,root) /usr/bin/openssl /usr/lib64/libcrypto.so.1.1 /usr/lib64/libssl.so.1.1 %files devel %{openssldir}/include/* %defattr(-,root,root) %post -p /sbin/ldconfig %postun -p /sbin/ldconfig EOF mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} cp ~/openssl/openssl.spec /root/rpmbuild/SPECS/openssl.spec mv openssl-1.1.1i.tar.gz /root/rpmbuild/SOURCES cd /root/rpmbuild/SPECS && \ rpmbuild \ -D "version 1.1.1i" \ -ba openssl.spec # Before Uninstall Openssl : rpm -qa openssl # Uninstall Current Openssl Vesion : yum -y remove openssl # For install: rpm -ivvh /root/rpmbuild/RPMS/x86_64/openssl-1.1.1i-1.el7.x86_64.rpm --nodeps # Verify install: rpm -qa openssl # openssl version
1. 安裝包說明centos
[root@testserver3 tmp]# ls openssl-1.1.1i.el7.offline.tar #U盤帶此包 [root@testserver3 tmp]# tar xf openssl-1.1.1i.el7.offline.tar [root@testserver3 tmp]# ls openssl-1.1.1i.el7.offline openssl-1.1.1i.el7.offline.tar [root@testserver3 tmp]# cd openssl-1.1.1i.el7.offline [root@testserver3 openssl-1.1.1i.el7.offline]# ll total 5636 -rw-r--r--. 1 root root 5395212 Jan 7 15:14 openssl-1.1.1i-1.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 133324 Jan 7 15:14 openssl-debuginfo-1.1.1i-1.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 234584 Jan 7 15:14 openssl-devel-1.1.1i-1.el7.centos.x86_64.rpm [root@testserver3 openssl-1.1.1i.el7.offline]#
注:以上rpm包爲根據官方源碼包openssl-1.1.1i.tar.gz rpmbuild生成,本升級只用到openssl-1.1.1i-1.el7.centos.x86_64.rpm這個包。(rpmbuild打包腳本後面提供)bash
2.安裝服務器
2.1.安裝前查看狀態curl
[root@testserver3 openssl-1.1.1i.el7.offline]# rpm -aq openssl openssl-1.0.2k-12.el7.x86_64 [root@testserver3 openssl-1.1.1i.el7.offline]# rpm -qa |grep openssl openssl-libs-1.0.2k-12.el7.x86_64 openssl-1.0.2k-12.el7.x86_64 xmlsec1-openssl-1.2.20-7.el7_4.x86_64
2.2.卸載當前版本opensslide
[root@testserver3 openssl-1.1.1i.el7.offline]# rpm -e openssl –nodeps [root@testserver3 openssl-1.1.1i.el7.offline]# openssl -bash: /usr/bin/openssl: No such file or directory [root@testserver3 openssl-1.1.1i.el7.offline]# rpm -aq openssl [root@testserver3 openssl-1.1.1i.el7.offline]# [root@testserver3 openssl-1.1.1i.el7.offline]# rpm -qa |grep openssl openssl-libs-1.0.2k-12.el7.x86_64 xmlsec1-openssl-1.2.20-7.el7_4.x86_64
2.3.安裝新版本及驗證post
[root@testserver3 openssl-1.1.1i.el7.offline]# rpm -ivh openssl-1.1.1i-1.el7.centos.x86_64.rpm --nodeps Preparing... ################################# [100%] Updating / installing... 1:openssl-1.1.1i-1.el7.centos ################################# [100%] [root@testserver3 openssl-1.1.1i.el7.offline]# [root@testserver3 openssl-1.1.1i.el7.offline]# [root@testserver3 openssl-1.1.1i.el7.offline]# rpm -aq openssl openssl-1.1.1i-1.el7.centos.x86_64 [root@testserver3 openssl-1.1.1i.el7.offline]# [root@testserver3 openssl-1.1.1i.el7.offline]# openssl version OpenSSL 1.1.1i 8 Dec 2020
注:更新後要驗證服務器能夠正常登錄測試