CentOS6升级openssh9.8最新版(tar包方式)

目录

安装所需软件:

1、卸载openssh

2、安装zlib

3、安装openssl

4、安装pam-devel

5、安装openssh


安装所需软件:

        文中所用的软件版本(此处下载)

        也可在官网下载所需版本,其它版本未经测试,使用前请先在测试环境测试。

       安装前尽量先开启telnet,以防不测。

        也可以在执行完每条编译命令和安装命令后执行echo $?,输出0即为正常无报错。

        若有问题欢迎留言讨论。


1、卸载openssh

      查询系统自带的openssh包

                rpm -qa|grep openssh

      卸载系统自带的openssh包

                rpm -e --nodeps openssh……  (--nodeps为强制卸载,不动用依赖包)


2、安装zlib

                解压压缩包

                        tar -zxvf zlib-1.2.11.tar.gz

                 进入目录        

                        cd zlib-1.2.11

                编译并安装

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

                        2.    make

                        3.    make install


3、安装openssl

                解压压缩包

                        tar -zxvf openssl-1.1.1m.tar.gz

                进入目录

                        cd openssl-1.1.1m

                编译并安装

                        ./config --prefix=/usr/local/openssl

                        make

                        make install


4、安装pam-devel

                rpm -ivh pam-devel-1.1.1-10.el6_2.1.x86_64.rpm


5、安装openssh

                解压压缩包

                        tar -zxvf openssh-9.8p1.tar.gz

                进入目录

                        cd openssh-9.8p1

                将新编译的openssl library 加入系统动态库连接中

                        vim /etc/ld.so.conf

                添加openssl安装目录

                        /usr/local/openssl/lib

                刷新库文件

                        ldconfig

                编译并安装

                        ./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib --with-md5-passwords --without-hardening --enable-dsa-keys --with-pam

                        make

                        make install

                配置dsa密钥:

                        ./ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

                两次回车(这是输入两次密码短语,可为空,按需使用)

                修复 SELinux 上下文(若是开启selinux则需要执行此命令):

                        restorecon -Rv /etc/ssh

                修改配置文件

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

                        chmod +x /etc/init.d/sshd 

                        vim /etc/init.d/sshd

                修改下列两行

                        25行    SSHD=/usr/sbin/sshd 为 SSHD=/usr/local/openssh/sbin/sshd

                        42行    /usr/bin/ssh-keygen -A 为 /usr/local/openssh/bin/ssh-keygen -A

                保存退出

                加入到系统服务

                        chkconfig --add sshd

                重启sshd服务

                        service sshd restart

                修改配置文件

                        vim /etc/ssh/sshd_config

                   将PermitRootLogin no(有时是PermitRootLogin prohibit-password)改为PermitRootLogin yes

                重启sshd服务

                         service sshd restart

                设置 ssh -V验证码版本

                        cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd

                        cp /usr/local/openssh/bin/ssh /usr/bin/

                查看ssh版本

                        ssh -V

  • 10
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

喂鱼喂鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值