Chinaunix首页 | 论坛 | 博客
  • 博客访问: 33034
  • 博文数量: 20
  • 博客积分: 185
  • 博客等级: 入伍新兵
  • 技术积分: 195
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-04 09:37
文章分类

全部博文(20)

文章存档

2015年(5)

2014年(7)

2012年(3)

2011年(5)

我的朋友

分类: LINUX

2015-06-10 17:05:08

第一步 准备安装包 

将所需安装包上传到服务器

zlib-1.2.8.tar.gz 

openssl-1.0.1.tar.gz 

openssh-6.6p1.tar.gz  

选择telnet进行远程操作  

第三步 程序升级 

1、停止SSHD服务 

# /sbin/service sshd stop 

2、备份启动脚本 

# cp /etc/init.d/sshd  /root/ 

3、卸载系统里原有Openssh 

# rpm –qa|grep openssh  //查询系统原安装的openssh,全部卸载。

# rpm -e openssh --nodeps 

# rpm -e openssh-server --nodeps 

# rpm -e openssh-clients --nodeps 

# rpm -e openssh-askpass 

4、解压安装zlib包: 

# tar -zxvf zlib-1.2.8.tar.gz //首先安装zlib库,否则会报zlib.c错误无法进行

 # cd zlib-1.2.8 

# ./configure

# make&&make install 

5、解压安装openssl包: 

# tar -zxvf openssl-1.0.1g.tar.gz # cd openssl-1.0.1g

# ./config shared zlib 

# make 

# make test

# make install 

# mv /usr/bin/openssl /usr/bin/openssl.OFF 

# mv /usr/include/openssl /usr/include/openssl.OFF  //该步骤可能提示无文件,忽略即可 

# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl 

# ln -s /usr/local/ssl/include/openssl /usr/include/openssl //移走原先系统自带的openssl,将自己编译产生的新文件进行链接。 

6、配置库文件搜索路径 

# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf 

# /sbin/ldconfig -v 

# openssl version -a OpenSSL 1.0.1 14 Mar 2012 

built on: Fri Mar 16 17:14:50 CST 2012 platform: linux-x86_64 

options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)  compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 

-DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM OPENSSLDIR: "/usr/local/ssl" 

7、解压安装openssh: 先将将/etc/ssh的文件夹备份:

 # mv /etc/ssh /etc/ssh_bak 

# tar -zxvf openssh-6.6p1.tar.gz # cd openssh-6.6p1 

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

--with-ssl-dir=/usr/local/ssl  --with-md5-passwords --mandir=/usr/share/man # make 

 # make install 

8、启动调试ssh 

# /usr/sbin/sshd -d 

debug1: sshd version OpenSSH_5.9p1 

debug1: read PEM private key done: type RSA debug1: private host key: #0 type 1 RSA debug1: read PEM private key done: type DSA debug1: private host key: #1 type 2 DSA debug1: read PEM private key done: type ECDSA debug1: private host key: #2 type 3 ECDSA debug1: rexec_argv[0]='/usr/sbin/sshd' debug1: rexec_argv[1]='-d' 

Set /proc/self/oom_adj from 0 to -17 debug1: Bind to port 22 on ::. 

Bind to port 22 on :: failed: Address already in use. debug1: Bind to port 22 on 0.0.0.0. 

Bind to port 22 on 0.0.0.0 failed: Address already in use. Cannot bind any address. 

此时可以尝试远程ssh进去服务器,如果能连,并查看验证日志信息等确认无误后,科继续一下步骤 

9、启动服务 

# cp -p contrib/redhat/sshd.init /etc/init.d/sshd # chmod +x /etc/init.d/sshd # chkconfig --add sshd 

# cp sshd_config /etc/ssh/sshd_config  (如提示覆盖,yes回车) # cp sshd /usr/sbin/sshd   (如提示覆盖,yes回车) 

10、验证是否成功 service sshd restart 

ssh -V   //如果看到了新的版本号就没问题啦!

阅读(660) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~