1.      首先挂载CentOS6.5镜像

mkdir/mnt/cdrom

mount/dev/cdrom /mnt/cdrom

2.      修改repo文件

Vi/etc/yum.repos.d/yum.repo

[local]

Name=local

Baseurl=file:///mnt/cdrom/Server

Enabled=1

Gpgcheck=0

3.      Yum clean all

Yum install gcc*

 

4.      卸载系统自带的openssh,卸载之前先停止sshd服务,再用rpm删除,同时清除系统/etc/ssh目录

[root@CentOS tmp]# service sshd stop

Stopping sshd:                                            [  OK  ]

[root@CentOS tmp]# rpm -qa openssh

openssh-5.3p1-94.el6.x86_64

[root@CentOS tmp]# rpm -e --nodeps openssh-server

[root@CentOS tmp]# rpm -e --nodeps openssh-clients

[root@CentOS tmp]# rpm -e --nodeps openssh-askpass

[root@CentOS tmp]# rpm -e--nodeps openssh

[root@CentOS tmp]# rm -rf /etc/ssh

重启!!!

5.      上传zlib,安装zlib

[root@CentOS tmp]# tar -xvf zlib-1.2.8.tar.gz

[root@CentOS tmp]# cd zlib-1.2.8

[root@CentOS zlib-1.2.8]# ./configure --prefix=/usr/local/zlib &&make && make install

 

6.      上传openssl文件,解压,文件夹下打开console

./config --prefix=/usr/local/openssl && make && make install

 

7.      上传openssh文件,解压,

./configure--prefix=/usr/ --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl--with-zlib=/usr/local/zlib --with-md5-passwords --without-hardening &&make && make install

 

8.      修改配置文件

[[email protected]]# cp contrib/redhat/sshd.init /etc/init.d/sshd

[[email protected]]# chmod +x /etc/init.d/sshd 一般自带x权限

不用再修改文件了

[[email protected]]#rpm -qa openssh

 openssh-5.3p1-122.el6.x86_64

9.      加入到系统服务

 

[[email protected]]# chkconfig --add sshd

[[email protected]]# service sshd start

 

10.   检查版本

ssh -V   注意大写

OpenSSH_6.6p1, OpenSSL 1.0.1e-fips 11 Feb 2013