暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openssh升级总结

大碗岛星期天下午的梦 2018-12-13
1753

1.升级openssh,如果服务器装有数据库,要注意是否做了与其他机器的互信,升级过后会导致原有互信失效,会导致数据库与互信机器连接中断;


2.由于操作系统版本众多,大版本下还有细版本,每一种版本的升级可能有出现不同的问题,问题不大并且有一定程度上的同性。针对每个版本出现的问题,进行分析、规避、解决不大现实,我们无法穷尽导致问题的原因。因此,只能在升级之前,做好回退方案和保险方案,在升级失败的时候有时间分析解决,也能保证最后全身而退;


3.主机分为虚拟机和物理机,物理机是否能通过IMM口登录,虚机能否通过esxi后台登录,设置确定ssh服务开机自启,在各种无法连接的情况下,能通过重启服务器开启ssh服务;


4.升级openssh的时候,有编译和rpm包两种升级方式,初时自己编译的rpm升级会出现各种问题,主要问题在配置文件/etc/ssh/sshd_config,默认情况下sshd_config配置文件全部注释掉。在rpm或者编译升级完成之后,很有可能配置文件被修改,阻止了ssh远程登录, 如果没有检查配置文件就重启服务,会有远程不上的风险;


5.如果用的是crt,打开两个独立窗口,同时root连接运行top,防止出现升级过程单个窗口crt闪退。另外,升级的窗口应该有两个窗口连接,因为有的服务器在升级完成重启服务的时候,会连接不上;


6.在编译升级的时候,版本高的升级可不必关闭服务,具体高到哪个版本不清楚,大概openssh6.0以上的可以试一下,6.0以下的版本基本要先关闭服务才可以升级;


7.编译升级的时候,一共要编译3个包,其中openssl版本高低会影响升级成败,openssl版本低会导致升级失败,openssl版本高的时候,可以直接跳过此升级,直接升级openssh,具体哪些版本可以跳过不明确,接近最新的几个版本一般都可以;


8、先升级zlib,再升级openssl,最后升级openssh。版本在7以上可以直接不停服务,直接升级openssh。

一一2017.9.26



编译例子:

[root@localhost ~]#chkconfig --add sshd

[root@localhost ~]#chkconfig sshd on

[root@localhost ~]#cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak    #回退的时候起作用,如果是用于升级之后的覆盖,对于版本跨越度大的升级不可行

[root@localhost ~]#/etc/init.d/sshd stop

[root@localhost ~]#cp /etc/init.d/sshd /home/ipnet/

[root@localhost ~]#tar -zxvf zlib.tar openssl.tar openssh.tar



#开始编译zlib

[root@localhost zlib]#./configure

[root@localhost zlib]#make&&make install



#开始编译openssl

[root@localhost openssl]#./config shared zlib            #或者./config --prefix=/usr --shared

[root@localhost openssl]#make&&make install

[root@localhost openssl]#mv /usr/bin/openssl /usr/bin/openssl.OFF

[root@localhost openssl]#mv /usr/include/openssl /usr/include/openssl.OFF

[root@localhost openssl]#ln -s /usr/local/ssl/bin/openssl /uastsr/bin/openssl      #可能会提示无此文件,忽略就好

[root@localhost openssl]#ln -s /usr/local/ssl/include/openssl /usr/include/openssl         #可能会提示无此文件,忽略就好

[root@localhost openssl]#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

[root@localhost openssl]#/sbin/ldconfig -v

[root@localhost openssl]#openssl version -a



#开始编译openssh

[root@localhost openssh]#cp /etc/ssh /home/jimmy/ssh_bak

[root@localhost openssh]#./configure --prefix=/usr --sysconfdir=/etc/ssh  --with-zlib --with-ssl-dir=/usr/local/ssl  --with-md5-passwords --mandir=/usr/share/man

[root@localhost openssh]#make&&make install

[root@localhost openssh]#cp -p contrib/redhat/sshd.init /etc/init.d/sshd        #redhat系统执行

[root@localhost openssh]# cp -p contrib/suse/rc.sshd /etc/init.d/sshd             #suse系统执行

[root@localhost openssh]#chmod +x /etc/init.d/sshd

[root@localhost openssh]#chkconfig --add sshd

[root@localhost openssh]#cp sshd_config /etc/ssh/sshd_config                 #如有提示,回复yes覆盖

[root@localhost openssh]#cp sshd /usr/sbin/sshd                               #如有提示,回复yes覆盖



[root@localhost ~]#/etc/init.d/sshd start

[root@localhost ~]#/etc/init.d/sshd status

[root@localhost ~]#ssh -V                      #检查版本是否升级成功


文章转载自大碗岛星期天下午的梦,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论