centos6 升级安装openssh7

Posted hunteryi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6 升级安装openssh7相关的知识,希望对你有一定的参考价值。

1、准备工作:

查看下当前SSH版本: [[email protected] ~]# ssh -V

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 或者

[[email protected] ~]# rpm -qa | grep openssh

openssh-server-5.3p1-122.el6.x86_64

openssh-clients-5.3p1-122.el6.x86_64

openssh-5.3p1-122.el6.x86_64

openssh-askpass-5.3p1-122.el6.x86_64

2、确认、安装依赖包: 确认三个依赖包是否安装

[[email protected] ~]# rpm -qa |grep zlib-devel zlib-devel-1.2.3-29.el6.x86_64

[[email protected] ~]# rpm -qa |grep openssl-devel

openssl-devel-1.0.1e-48.el6_8.1.x86_64

[[email protected] ~]# rpm -qa |grep gcc

libgcc-4.4.7-17.el6.x86_64 gcc-c++-4.4.7-17.el6.x86_64

gcc-4.4.7-17.el6.x86_64

gcc-gfortran-4.4.7-17.el6.x86_64

以上为安装了依赖包,如未安装可执行以下命令安装[[email protected] soft]#yum install gcc openssl-devel zlib-devel 我在这里是用yum安装的,或者上传tar包手动安装

3 、 下 载 最 新 版 openssh [[email protected] ~]# cd /data/soft/

 

手动上传tar包或者通过以下命令直接下载tar包[[email protected]]#

wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-7.5p1.tar.gz

wget https://openbsd.mirror.netelligent.ca/pub/OpenBSD/OpenSSH/portable/openssh-7.4p1.tar.gz

 

4、备份卸载旧openssh: 备份ssh:

[[email protected] ~]# mv /etc/ssh/ /etc/ssh.bak 卸载旧版的openssh

[[email protected] ~]# rpm -e --nodeps `rpm -qa | grep openssh` 卸载后执行

rpm -qa | grep openssh 查看是否卸载干净

 

5、编译安装openssh: 解压安装包:

[[email protected] soft]# tar -zxf openssh-7.5p1.tar.gz

[[email protected] soft]# cd openssh-7.5p1/

编译:

[[email protected] openssh-7.5p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh

[[email protected] openssh-7.5p1]# make && make install

查看下安装结果:

[[email protected] openssh-7.5p1]# ssh -V

OpenSSH_7.5p1, OpenSSL 1.0.1e-fips 11 Feb 2013 至此编译安装完成。

6、配置sshd服务:

复制启动文件到/etc/init.d/下并命名为sshd:

[[email protected] openssh-7.5p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd 加入开机启动:

[[email protected] openssh-7.5p1]# chkconfig --add sshd

7、配置允许root使用ssh:

openssh7.5默认root用户是不能用ssh远程登录的,需要修改配置文件: [[email protected] openssh-7.5p1]# vim /etc/ssh/sshd_config

添加如下代码PermitRootLogin yes 重启ssh服务:

[[email protected] openssh-7.5p1]# service sshd restart

 

至此升级/安装完成。

 

注:

如果报错:configure: error: *** zlib.h missing - please install first or check config.log

***,需要安装zlib-devel

[[email protected] openssh-7.5p1]# yum install -y zlib-devel

如果报错:configure: error: *** OpenSSL headers missing - please install first or check config.log ***,需要安装openssl-devel

[[email protected] openssh-7.5p1]# yum install -y openssl-devel

以上是关于centos6 升级安装openssh7的主要内容,如果未能解决你的问题,请参考以下文章

CentOS6.x升级安装python2.7

CentOS6.5升级手动安装GCC4.8.2

虚拟机安装的centos6.5怎么升级到centos7

CentOS6升级CentOS7

CentOS6.5升级手动安装GCC4.8.2

centos6.3环境下升级python及MySQLdb的安装