CentOS7.9 rpm包升级OpenSSH9.8

CentOS7.9 rpm包升级OpenSSH9.8📛


CentOS7.9通过rpm方式升级OpenSSH9.8,制作OpenSSH的rpm包可查看上期文章。

rpm包制作OpenSSH

1. 准备工作

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

⭐⭐ telnet默认不允许root用户登录,可以创建普通用户登录系统。或者执行以下命令临时登录:

允许 root 登录(临时):

[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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值