Centos6.5 openssh 5.4离线 升级为 openssh 7.7,使用rpm包安装

Centos6.5 openssh 5.4离线 升级为 openssh 7.7,使用rpm包安装

很多linux 没有gcc c++ 等编译环境,并且处于内网环境,无法通过yum 命令直接安装软件,又由于编译软件所需要的依赖较多,安装起来相当麻烦。所以使用一台可以联网的Linux 将源码打成rpm包,在去内网linux 安装,即可省去内网linux 安装编译环境所带来的的困扰

版本

Linux Centos6.5
OpenSSH 5.3 升级到OpenSSH 7.7

将openssh 7.7 源码打包成rpm

具体打包步骤

https://blog.csdn.net/crime_lamb/article/details/131282433

或直接下载打好的包

https://download.csdn.net/download/crime_lamb/87928374

注意事项

由于升级的是SSH 如果操作不好就再也无法通过客户端远程上服务器了,
操作前一定多创建几个连接,并在修改后确认可以再次连接上后再关闭其他远程连接

包目录

  • openssh7.7rpm.zip
    • openssh-7.7p1-1.el6.x86_64.rpm
    • openssh-clients-7.7p1-1.el6.x86_64.rpm
    • openssh-server-7.7p1-1.el6.x86_64.rpm

安装

安装
  • 1.更新
# 由于依赖问题需要先卸载 openssh5.3 中的openssh-askpass-5.3p1-94.el6.x86_64
rpm -e --nodeps openssh-askpass
# 使用rpm 更新包
rpm -Uvh openssh*
  • 2.修改配置

    # 修改sshd 配置文件,找到相应配置,并改成一下配置
    # /etc/ssh/sshd_config
    PermitRootLogin yes
    PasswordAuthentication yes
    UsePAM yes
    
  • 3.修改系统文件

    vim /etc/pam.d/ssh
    # 直接覆盖原ssh的文件内容
    #%PAM-1.0
    auth       required pam_sepermit.so
    auth       include      password-auth
    account    required     pam_nologin.so
    account    include      password-auth
    password   include      password-auth
    # pam_selinux.so close should be the first session rule
    session    required     pam_selinux.so close
    session    required     pam_loginuid.so
    # pam_selinux.so open should only be followed by sessions to be executed in the user context
    session    required     pam_selinux.so open env_params
    session    optional     pam_keyinit.so force revoke
    session    include      password-auth
    
  • 4.重启sshd

    # 重启sshd
    service sshd restart
    
安装命令扩展
  • 安装

    # 安装
    rpm -ivh xxxx
    
  • 更新

    # rpm 模拟安装rpm包,可以提前检查出缺失的依赖(* 是匹配所有,也可以一个一个测试安装)
    rpm -Uvh --test openssh*
    # 更新(解决完依赖后,安装)
    rpm -Uvh openssh*
    
  • 卸载

    # 卸载包,但不卸载依赖
    rpm -e --nodeps xxx
    

扩展

错误排查

  • SSH连接日志查看(客户端连接不上服务器)

    # 如客户端链接不上,可根据里面提示再具体百度
    tail -f /var/log/messages
    

参考内容

使用编译方式安装
https://www.jianshu.com/p/de60b02b9ead

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值