Centos7.2升级openssh为9.0p1

您所在的位置:网站首页 centos卸载cuda Centos7.2升级openssh为9.0p1

Centos7.2升级openssh为9.0p1

2023-04-09 13:22| 来源: 网络整理| 查看: 265

1、基础准备

官方网站下载最新版*.tar.gz安装包:

官方下载地址:http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/

openssh-9.0p1.tar.gz (注意:要下载p1版,此版为编译安装包)

官方下载地址:https://www.openssl.org/source/

openssl-1.1.1q.tar.gz

官方下载地址: http://www.zlib.net/

zlib-1.2.12.tar.gz————————————————当然这边也全部下载好了,提供百度网盘

链接:https://pan.baidu.com/s/1UoSCLNGQUq7Kuqqga3POhg?pwd=1111 提取码:1111 --来自百度网盘超级会员V8的分享

 

2、系统环境

ssh -V

可以查看当前版本

 

3.升级openssh的步骤3.1解压所有上传的压缩包

tar -zxvf  openssh-9.0p1.tar.gz

tar -zxvf  openssl-1.1.1q.tar.gz

tar -zxvf  zlib-1.2.12.tar.gz

3.2 编译安装zlib

cd zlib-1.2.12

./configure --prefix=/usr/local/zlib

编译zlib出错,请安装gcc yum install gcc

make && make install

echo '/usr/local/zlib/lib' >> /etc/ld.so.conf ldconfig -v

  

验证zlib安装是否成功,要包含include、lib、share三个目录。

 a5d5a4398a322e9d9304bf26f1ebfe82.png

3.3编译安装openssl

cd openssl-1.1.1q

./config --prefix=/usr/local/ssl -d shared

make && make install (时间比较长,切勿打断)

echo '/usr/local/ssl/lib' >> /etc/ld.so.conf

ldconfig -v

3.4通过Telnet登录到服务器,务必3.4.1安装telnet(服务端客户端都安装)

yum install -y telnet

yum install -y telnet-server

yum install -y xinetd

3.4.2修改配置文件(默认是没有的,执行)

vim /etc/xinetd.d/telnet

service telnet{flags = REUSEsocket_type = streamwait = nouser = rootserver = /usr/sbin/in.telnetdlog_on_failure += USERIDdisable = yes #改为 no 或者注释这一行}

3.4.3重启telnet服务

service xinetd restart

3.4.4测试:

[root@localhost pam.d]# telnet localhost

如果无法登陆,解决方法:修改/etc/pam.d/remote,注释掉:auth    required   pam_securetty.so

wKiom1ds8jjADSy5AABjgIQDpOs543.png-wh_50

 

3.4.5如果发现端口不通,则排查防火墙,关闭防火墙

systemctl stop firewalld.service

3.5升级安装openssh3.5.1停止服务并且备份

停止ssh服务systemctl stop sshd备份ssh配置文件cp -r /etc/ssh /etc/ssh.old

  查看系统原有openssh包

rpm -qa | grep openssh根据上面查询出的结果,卸载系统里原有Openssh(一般有三个包,全部卸载)rpm -e --nodeps xxxxxxxxxxrpm -e --nodeps openssh-server-7.4p1-21.el7.x86_64rpm -e --nodeps openssh-7.4p1-21.el7.x86_64rpm -e --nodeps openssh-clients-7.4p1-21.el7.x86_64卸载完成后执行rpm -qa | grep openssh,确保没有回显rpm -qa | grep openssh

  

3.5.2安装openssh

cd openssh-9.0p1

./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl

make && make install#查看目录版本 /usr/local/ssh/bin/ssh -V

#复制新ssh文件(由于我这边压缩包都在/root下。不同的请自行更改路径)cp -rf /root/openssh-9.0p1/contrib/redhat/sshd.init /etc/init.d/sshdcp -rf /root/openssh-9.0p1/contrib/redhat/sshd.pam /etc/pam.d/sshd.pamcp -rf /root/openssh-9.0p1/sshd_config /etc/ssh/sshd_configcp -rf /usr/local/ssh/sbin/sshd /usr/sbin/sshdcp -rf /usr/local/ssh/bin/ssh /usr/bin/sshcp -rf /usr/local/ssh/bin/ssh-keygen /usr/bin/ssh-keygen#开启sshdchmod u+x /etc/init.d/sshd;chkconfig --add sshd ##自启动chkconfig --list |grep sshdchkconfig sshd on#允许root登录echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config#重启sshd服务/etc/init.d/sshd restart/etc/init.d/sshd status#查看升级后ssh版本ssh -V————————————————

  

确定没有问题后在关闭telnet服务

#关闭telnet服务systemctl stop xinetd.servicesystemctl stop telnet.socket

#卸载telnet服务yum remove xinetd telnet-server telnet -y

#防火墙问题比较敏感,生产请谨慎

 

SSH启动失败问题

1.Permissions 0737 for ‘/etc/ssh/ssh_host_rsa_key’ are too open”问题

chmod 600 /etc/ssh/ssh_host_rsa_keychmod 600 /etc/ssh/ssh_host_dsa_keychmod 600 /etc/ssh/ssh_host_ecdsa_keychmod 600 /etc/ssh/ssh_host_ed25519_key

  

如果报OpenSSL升级后导致libcrypt.so.10和libssl.so.10找不到的解决https://blog.csdn.net/yin138/article/details/110820145

提供linux库文件

链接:https://pan.baidu.com/s/19AlKrA8EJCZV_kzZk55SsA?pwd=1111 提取码:1111

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3