CentOS7.9 rpm包升级OpenSSH9.8📛
CentOS7.9通过rpm方式升级OpenSSH9.8,制作OpenSSH的rpm包可查看上期文章。
https://www.cnblogs.com/haoee/p/17733065.html
准备工作
1.1 备份现有配置
备份 /etc/ssh/sshd_config
和其他关键文件:
[root@localhost ~]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
[root@localhost ~]# cp -r /etc/ssh /etc/ssh_backup
1.2 安装 Telnet 作为备用连接(防止升级失败导致 SSH 无法连接)⭐
# Ubuntu/Debian
[root@localhost ~]# sudo apt install telnetd xinetd -y
[root@localhost ~]# sudo systemctl start telnet.socket
[root@localhost ~]# sudo systemctl start xinetd
# CentOS/RHEL
[root@localhost ~]# sudo yum install telnet-server xinetd -y
[root@localhost ~]# sudo systemctl start telnet.socket
[root@localhost ~]# sudo systemctl start xinetd
[root@localhost ~]# echo 'pts/0' >> /etc/securetty
[root@localhost ~]# echo 'pts/1' >> /etc/securetty
2. 升级OpenSSH
将制作好的rpm包上传到服务器,执行安装命令。
[root@localhost ~]# cp openssh9.8p1.tar.gz /opt/
[root@localhost ~]# cd /opt
[root@localhost opt]# tar -xvf openssh9.8p1.tar.gz
[root@localhost opt]# ll
total 21048
-rw-r--r-- 1 root root 6633652 Jul 4 2024 openssh-9.8p1-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 6719672 Jul 4 2024 openssh-clients-9.8p1-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 4660872 Jul 4 2024 openssh-debuginfo-9.8p1-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 3534328 Jul 4 2024 openssh-server-9.8p1-1.el7.x86_64.rpm
[root@localhost opt]# yum -y install ./*.rpm
查看ssh版本
[root@localhost ~]# ssh -V
OpenSSH_9.8p1, OpenSSL 3.0.14 4 Jun 2024