centos6.4升级openssh7.4p1

Centos6.4版本yum升级openssh版本最高到5.3,想要升级到更高的版本需要重新编译

一、查看当前openssh版本:

[root@localhost ~]# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

二、编译libssl.so

查看是否存在libssl.so 

# ls -al /usr/lib64/libssl.so*

如果不存在,编译libssl.so

1、下载libssl.so.10的编译包

# wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1e.tar.gz

2、解压编译

#./config shared zlib-dynamic

# make

3、建立软连接

通过上述操作可以得到两个文件

libssl.so.1.0.0

libcrypto.so.1.0.0

将这两个文件cp到/usr/lib64下面,并建立软连接即可

cd /usr/lib64/

ln -s libssl.so.1.0.0          libssl.so.10

ln -s libcrypto.so.1.0.0    libcrypto.so.10

三、编译openssh7.4p1

1、卸载旧的openssh

# rpm -e --nodeps `rpm -qa | grep openssh`

2、编译安装新版本openssh7.4p1

下载软件包

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

解压编译

# tar -xvf openssh-7.4p1.tar.gz

# cd openssh-7.4p1

# ./configure --prefix=/usr --sysconfdir=/etc/ssh

# make & make install

3、配置并启动sshd服务

# cp openssh-7.4p1/contrib/redhat/sshd.init /etc/init.d/sshd

# chkconfig --add sshd

修改配置文件:[root@bogon openssh-7.5p1]# vim /etc/ssh/sshd_config

找到#PermitRootLogin prohibit-password项,去掉注释并把prohibit-password改为yes

PermitRootLogin yes

重启服务

# service sshd restart

4、检查版本信息:

# ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013

5、编译报错信息集合

(1)#./configure --prefix=/usr --sysconfdir=/etc/ssh

checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/openssh-7.4p1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

解决方法:# yum install -y gcc

(2)#./configure --prefix=/usr --sysconfdir=/etc/ssh

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

解决方法:# yum install -y zlib-devel

(3)#./configure --prefix=/usr --sysconfdir=/etc/ssh

configure: error: *** OpenSSL headers missing - please install firstorcheck config.log

解决方法:# yum install -y openssl-devel

参考文献:https://www.jianshu.com/p/de60b02b9ead

猜你喜欢

转载自www.cnblogs.com/carriezhangyan/p/11840946.html