给大家分享一下Centos7.8如何更新安装openssh的经验。从版本7.4p1更新到9.4p1
工具/原料
HPBookPro14
Centos7.8
方法/步骤
1
安装telnet工具。(为了避免在升级的过程中断开)
#yum -y install telnet*
2
启用telnet服务
#systemctl enable telnet.socket
#systemctl start telnet.socket
3
关闭或者修改安全配置文件
注:(否则root无法telnet登录)
#mv /etc/securetty /etc/securetty.bak
4
使用telnet登录系统,准备升级Openssh
5
使用xftp工具上传更新包。
6
解压缩安装包
#tar -zxvf openssh-9.4p1.xx
7
切换至安装包目录,执行配置脚本。
# cd openssh-9.4p1-xx
# ./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/openssl
8
执行编译并编译安装
# make && make install
9
卸载原系统yum安装的openssh包
# yum remove openssh
10
在/etc目录下面新建ssh目录
# mkdir -p /etc/ssh
11
拷贝openssh安装目录下的配置文件至/etc/ssh目录下
# cp /usr/local/openssh/etc/* /etc/ssh/
12
编辑sshd_config配置文件
修改如图所示的三个地方,保存退出。
# vi /etc/ssh/sshd_config
#wq
13
复制文件到相应的系统文件夹
# cp /home/manager/openssh-9.4p1/contrib/redhat/sshd.init /etc/init.d/sshd
# cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
# cp /usr/local/openssh/bin/ssh /usr/bin/ssh
# cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
14
添加sshd系统启动,并启动sshd服务
# chkconfig --add sshd
# systemctl start sshd.service
15
查看openssh 运行状态,并添加openssh 开机自启服务。
查看openssh和openssl 版本
# systemctl status sshd.service
# systemctl enable sshd.service
# ssh -V
END注意事项
本步骤操作的前提:已经升级了系统openssl版本,应openssh依赖于openssl的原因,必须先升级openssl
温馨提示:经验内容仅供参考,如果您需解决具体问题(尤其法律、医学等领域),建议您详细咨询相关领域专业人士。免责声明:本文转载来之互联网,不代表本网站的观点和立场。如果你觉得好欢迎分享此网址给你的朋友。转载请注明出处:https://www.baikejingyan.net/af56bUG8CAQVRCw.html