openssh的运转需要openssl和zlib的支持,升级openssh最好同步升级openssl和zlib,避免出现不匹配的现象,此文只升级openssl和openssh。
1、安装telnet服务
# yum -y install telnet-server*
# rpm -qa | grep telnet
# vi /etc/xinetd.d/telnet
将disable字段改为no
# chkconfig --list xinetd
xinetd 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
# /etc/init.d/xinetd restart
# netstat -tnlp | grep :23
tcp 0 0 :::23 :::* LISTEN 5013/xinetd
2、安装编译软件
# yum -y install gcc pam-devel zlib-devel
3、下载OPENSSH和OPENSSL
--从站点上下在最新的软件包
http://www.zlib.net/
http://www.openssl.org/
http://www.openssh.org/
--解压
# tar -zxvf openssl-1.0.1g.tar.gz # tar -zxvf openssh-6.6p1.tar.gz
4、查看现有软件版本
# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar2010
# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
# rpm -q zlib
zlib-1.2.3-29.el6.x86_64
5、安装openssl
5.1 备份openssl
# find / -name openssl
/usr/lib64/openssl
/usr/bin/openssl
/etc/pki/ca-trust/extracted/openssl
# mv /usr/lib64/openssl /usr/lib64/openssl_old # mv /usr/bin/openssl /usr/bin/openssl_old # mv /etc/pki/ca-trust/extracted/openssl /etc/pki/ca-trust/extracted/openssl_old
5.2 卸载原有的
# rpm -qa | grep openssl
openssl-1.0.1e-15.el6.x86_64
# rpm -e --nodeps openssl-1.0.1e-15.el6.x86_64 # rpm -qa | grep openssl
5.3 安装openssl
先安装openssl, 一定记得加上--shared选项, 否则openssh编译的时候会找不到新安装的openssl的library, 会报错: openssl的 header和library版本不匹配。
# cd /opt/openssl-1.0.1g # ./config --prefix=/usr --shared # make # make test # make install
--查看
# openssl version -a
OpenSSL 1.0.1g 7 Apr 2014
6、安装openssh
6.1 备份
# mv /etc/ssh /etc/ssh_old
6.2 卸载openssh
# rpm -qa | grep openssh
openssh-clients-5.3p1-94.el6.x86_64
openssh-server-5.3p1-94.el6.x86_64
openssh-5.3p1-94.el6.x86_64
openssh-askpass-5.3p1-94.el6.x86_64
# rpm -e --nodepsopenssh-5.3p1-94.el6.x86_64 # rpm -e --nodepsopenssh-server-5.3p1-94.el6.x86_64 # rpm -e --nodeps openssh-clients-5.3p1-94.el6.x86_64 # rpm -e --nodepsopenssh-askpass-5.3p1-94.el6.x86_64 # rpm -qa | grep openssh
6.3 安装
# cd /opt/openssh-6.6p1
configure: error: *** zlib.h missing -please install first or check config.
# yum install zlib-devel # ./configure--prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib--without-zlib-version-check --with-openssl-includes=/usr/ --with-md5-passwords--mandir=/usr/share/man
# make # makeinstall
6.4 启动ssh服务
#/usr/sbin/sshd # ssh -V
OpenSSH_6.6p1,OpenSSL 1.0.1g 7 Apr 2014
# vi /etc/ssh/sshd_config
设置 X11Forwarding yes
#X11Forwardingno
X11Forwardingyes
--查看ssh服务
#/usr/sbin/sshd -d #netstat -tnlp | grep :22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2204/sshd
tcp 0 0 :::22 :::* LISTEN 2204/sshd
--设置开机自启动
# cp -pcontrib/redhat/sshd.init /etc/init.d/ssh # chmod+x /etc/init.d/sshd # chkconfig --add sshd # chkconfig sshd on # chkconfig --list sshd
7 停止telnet服务
# chkconfig xinetd off # /etc/init.d/xinetd stop
附录:
1、卸载zlib,错误处理
# rpm-qa | grep zlib
zlib-1.2.3-29.el6.x86_64
# rpm -e--nodeps zlib-1.2.3-29.el6.x86_64
# rpm-qa | grep zlib
rpm:error while loading shared libraries: libz.so.1: cannot open shared objectfile: No such file or directory
--解决办法
#ldd/bin/rpm |grep libz.so.1
libz.so.1 => not found
libz.so.1 => not found
libz.so.1 => not found
libz.so.1 => not found
libz.so.1 => not found
# find /-name libz.so.1
/lib64/libz.so.1
# ll /lib64/libz.so.1
lrwxrwxrwx.1 root root 13 11月 16 2013 /lib64/libz.so.1 -> libz.so.1.2.3
从另外一台RHEL 6.5上拷贝libz.so.1.2.3放到/lib64/目录下,创建连接
# cd /lib64/ # ln -slibz.so.1.2.3 libz.so.1
# yum install pam-dev
Therewas a problem importing one of the Python modules
requiredto run yum. The error leading to this problem was:
libssl.so.10: cannot open shared objectfile: No such file or directory
libcrypto.so.10: cannot open shared objectfile: No such file or directory
解决办法:
# cd /usr/lib64/ # ln-s libssl.so.1.0.0 libssl.so.10 # ln-s libcrypto.so.1.0.0 libcrypto.so.10
2、安装 Zlib1.2.8
--准备编译 Zlib:
#./configure --prefix=/usr
--编译程序包:
# make
--要测试结果,执行:
# makecheck
--安装程序包:
# makeinstall
--共享库需要移动到/lib,所以位于/usr/lib的.so 文件需要重新创建:
# mv -v/usr/lib/libz.so.* /lib
# ln-sfv /lib/libz.so.1.2.8 /usr/lib/libz.so
RHEL6.5升级安装OPENSSH,布布扣,bubuko.com