CentOS7升级OpenSSH9和OpenSSL3

更换源并更新系统

1
2
3
4
5
6
7
mkdir /etc/yum.repos.d-bak
mv /etc/yum.repos.d/* /etc/yum.repos.d-bak/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum makecache fast -y
yum update -y

Upgrading to OpenSSL 3.0 from OpenSSL 1.0.2

1 安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# root用户
export OpensslVersion="1.1.1q"
umask 002
yum install gcc gcc-c++ -y

# 下载最新版
cd /usr/local/src/
curl -k https://www.openssl.org/source/openssl-${OpensslVersion}.tar.gz -o openssl-${OpensslVersion}.tar.gz

# 解压
tar xf openssl-${OpensslVersion}.tar.gz

# 编译安装
cd openssl-${OpensslVersion}
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl '-Wl,-rpath,$(LIBRPATH)'
make -j4 && make install

# 备份老版本
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak 

# 软连接新版本
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf.d/openssl-x86_64.conf
ldconfig -v

# 检查版本
openssl version -a