centos5.1远程升级ssh到5.0p1

因为服务器在机房,所以不能删除ssh后再重新安装,只能升级安装

1.看看现在ssh的版本

ssh -V

是4.5的,最新的是5.0p1

2.去官方下载包,然后./configure --prefix=/usr --with-pam --with-md5-passwords --sysconfdir=/etc/ssh
发现老是Can't find recent OpenSSL libcrypto
干脆把ssl也升级下

3.升级ssl

看下版本

openssl version -a

OpenSSL 0.9.8b 04 May 2006

最新的是h了

先下载zlib-1.2.3.tar.gz安装下

tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --shared 不要忘了shared这个参数。
make
make install

 

安装ssl

tar -zxvf openssl-0.9.8h.tar.gz
cd openssl-0.9.8h
./config shared 一定要带共享参数哦
make
make test
make install
这样ssl就装在/usr/local/ssl里面啦

替换系统的ssl

find / -name openssl
/usr/bin/openssl(原来的)
/usr/lib/openssl(原来的)
/usr/local/ssl/bin/openssl(新的)
/usr/local/ssl/include/openssl(新的)

下面开始替换了


mv /usr/bin/openssl /usr/bin/oldopenssl
mv /usr/lib/openssl /usr/lib/oldopenssl

rm -rf /usr/lib/libcrypto.so
rm -rf /usr/lib/libssl.so

ln -s /usr/local/ssl/lib/libcrytpo.so.0.9.8 /usr/lib/libcrypto.so
ln -s /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so

ln /usr/local/ssl/bin/openssl /usr/bin/openssl

cp -r /usr/local/ssl/lib/* /usr/lib/openssl

echo /usr/local/ssl/lib >> /etc/ld.so.conf
ldconfig -v

好了

openssl version -a
OpenSSL 0.9.8h 28 May 2008

4。安装ssh

tar -zxvf openssh-5.0p1.tar.gz
./configure --with-ssl-dir=/usr/local/ssl --with-zlib --with-pam --with-md5-passwords

configure: error: PAM headers not found

安装下rpm -ivh ../pam-devel-0.99.6.2-3.26.el5.i386.rpm (安装盘里有)

./configure --with-ssl-dir=/usr/local/ssl --with-zlib --with-pam --with-md5-passwords 

make
make install

好了

ssh -V
OpenSSH_5.0p1, OpenSSL 0.9.8h 28 May 2008

5.配置

 

vi /usr/local/etc/sshd_config
Port 22
Protocol 2(建议只用2,1的有安全性问题)
ListenAddress 0.0.0.0
HostKey /usr/local/etc/ssh_host_key
HostKey /usr/local/etc/ssh_host_rsa_key
HostKey /usr/local/etc/ssh_host_dsa_key
SyslogFacility AUTH
LogLevel INFO
PermitRootLogin no(安全起见不要root登录,其他用户登,然后su过去)
RhostsRASAuthentication no
IgnoreRhosts yes
UsePrivilegeSeparation yes

 

你可能感兴趣的:(centos)