*注意:如果一次安装失败,下次安装前解压缩的目录一定要删除
升级openssh前需要先升级依赖包,教程如下
1、zlib-1.2.11.tar.gz
# tar xzvf zlib-1.2.11.tar.gz
#cd zlib-1.2.11
# ./configure --prefix=/usr/local/zlib
# make
# make install
这样,就把 zlib 编译安装在
/usr/local/zlib 中了
2、pam-devel-1.1.1-13.el6.x86_64.rpm
# rpm -ivh pam-devel-1.1.1-13.el6.x86_64.rpm
3、openssl-fips-2.0.16.tar.gz
# tar -xzvf openssl-fips-2.0.16.tar.gz
# cd openssl-fips-2.0.16
# ./config
# make
# make install
4、openssl-1.0.2p.tar.gz
#tar -zxvf openssl-1.0.2p.tar.gz
#cd /openssl-1.0.2p
#./config shared zlib --prefix=/usr/local/openssl && make && make install
# ./config -t
# make depend
# cd /usr/local
# ln -s openssl ssl
# vi /etc/ld.so.conf
文件的最后面,添加如下内容:
/usr/local/openssl/lib
#ldconfig
在etc/的profile的最后一行,添加:
export OPENSSL=/usr/local/openssl/bin
export PATH=$OPENSSL:$PATH:$HOME/bin
移除老版本的openssl,创建新的软连接;这个地方注意路径
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/include/openssl /usr/include/openssl.old
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -sf /usr/local/openssl/lib/libcrypto.so.1.0.0 /lib/libcrypto.so.6
echo "/usr/local/openssl/lib" >>/etc/ld.so.conf
ldconfig -v
# openssl version
4、openssh-7.8p1.tar.gz
#tar -xzvf openssh-7.8p1.tar.gz
# cd openssh-7.8p1
# rm -rf /etc/ssh
#make uninstall 删除旧版本
#./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib --without-hardening
#make
#make install
# cp /你的openssh的解压目录/contrib/redhat/sshd.init /etc/init.d/sshd
# chmod +x /etc/init.d/sshd
# chkconfig --add sshd
#vim /etc/ssh/sshd_config #修改默认端口号
#service sshd stop
# /etc/init.d/sshd restart 或 service sshd start
#cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
#cp /usr/local/openssh/bin/ssh /usr/bin/