0
点赞
收藏
分享

微信扫一扫

Openssh升级记录

执行升级前备份文件

cp -r /etc/ssh  /etc/ssh_bak

cp /etc/init.d/sshd  /etc/init.d/sshd_bak

cp /usr/sbin/sshd  /usr/sbin/sshd_bak

一、查看openssl

  1、查看openssl版本

       # rpm -qa |grep openssl

Openssh升级记录_OpenSSH离线升级安装

   2、执行卸载命令

       卸载时报错 error: "openssl-0.9.8e-22.el5" specifies multiple packages 需要加参数如下

      # rpm -e openssl-0.9.8e-22.el5 --allmatches --nodeps

        注意:(虚拟机测试 卸载后重启,可能导致账号需要重新配置,谨慎操作)

   3、安装openssl

     3.1、解压

         # tar –xf openssl-1.0.1h.tar.gz

        #cd openssl-1.0.1h

      3.2、配置

        # ./config  --prefix=/usr/local/ssl  --openssldir=/etc/ssl --shared

Openssh升级记录_OpenSSH离线升级安装_02

     3.3、编译安装

         # make && make install

                    (待验证) 3.4、#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

                                          #ldconfig

      3.4、设置软连接

            # ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

           # ln -s /usr/local/ssl/include/openssl /usr/include/openssl

                  配置ssl库(需要验证)

                     # cp /usr/local/ssl/lib/libssl.so.1.0.0  /usr/lib64

                    # cp /usr/local/ssl/lib/libcrypto.so.1.0.0  /usr/lib64

                    # ln -s /usr/lib64/libcrypto.so.1.0.0  /usr/lib64/libcrypto.so.10

                    # ln -s /usr/lib64/libcrypto.so.1.0.0  /usr/lib64/libcrypto.so

                    # ln -s /usr/lib64/libssl.so.1.0.0  /usr/lib64/libssl.so.10

                    # ln -s /usr/lib64/libssl.so.1.0.0  /usr/lib64/libssl.so

                    # ln -s /usr/local/ssl/bin/openssl  /usr/bin/openssl

                    #ln -s /usr/local/ssl/include/openssl  /usr/include/openssl

   3.5、查看版本

         # openssl  version  -a

二、升级openssh

    1.卸载旧版Openssh(如果远程需要先安装并开启telnet服务)

      1.1.确认OpenSSH需要删除的rpm包

          #  rpm -qa |grep ssh

Openssh升级记录_OpenSSH离线升级安装_03

   1.2.使用rpm的方式删除

    # rpm -e openssh openssh-clients openssh-server openssh-askpass --nodeps

2.安装openssh

  2.1.解压

    # tar –xf  openssh-7.4p1.tar.gz

    # cd  openssh-7.4p1

  2.2.配置

    # ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-ssl-dir=/usr/local/ssl --with-md5-passwords -- mandir=/usr/share/man 

   # ./configure   --prefix=/usr --sysconfdir=/etc/ssh  --with-md5-passwords --with-pam --with-tcp-wrappers   --with-ssl-dir=/usr/local/ssl --without-hardening 

  注: --prefix=/usr 意思:可执行文件(默认位置/usr/local/bin)、库文件(默认位置/usr/local/lib)、配置文件(默认位置/usr/local/etc) 都放在/usr下

  2.3.删除原ssh配置目录

     # rm  -rf  /etc/ssh

  2.4.编译安装

    # make && make install

  2.5.安装完成,执行配置

    #cp ./contrib/redhat/sshd.init  /etc/init.d/sshd

     (需要把解压的openssh包里文件sshd.init 复制并重命名/etc/init.d/sshd)

Openssh升级记录_OpenSSH离线升级安装_04

    #chkconfig --add sshd

   #chkconfig sshd on

   #chkconfig --list|grep sshd

 2.6.查看openssh版本号,验正安装结果

   # ssh -V

 2.7.允许root远程登录

   # sed -i "32 aPermitRootLogin yes" /etc/ssh/sshd_config

 2.8.重启服务

  # service  sshd  restart

 2.9.启动并验正服务的开启状况

   # /usr/sbin/sshd -d  检验

  # /usr/sbin/sshd     启动服务


另:

​​http://www.zlib.net/ ​​

​​http://www.openssl.org/ ​​

​​http://www.openssh.org/​​

举报

相关推荐

0 条评论