openssh升级到openssh-7.5p1踩坑

环境:ubuntu

需要的安装包:

http://zlib.net/   zlib 1.2.11最新版

http://www.linux-pam.org/library/   pam 1.3.0

https://github.com/openssl/openssl   openssl 1.0.2k

https://github.com/openssh/openssh-portable  openssh-7.5p1

(可以用wget 或者 git clone 获取,并选择特定的版本)

(注:源码安装坑还是很多的,如果可以用包安装的话尽量用包安装,折腾了几天才弄好,而且由于不熟悉linux,很多错误都要慢慢研究)

注意过程中如果不成功会导致无法使用ssh连接,所以成功之前最好打开多个连接窗口,成功后才关闭,过程中不要关闭电脑

需要切换到su账户

1.升级zlib

tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make && make install

2.升级pam

tar zxvf  Linux-PAM-1.3.0.tar.gz

cd Linux-PAM-1.3.0

./configure

make && make install

3、编译安装openssl

删除原来的版本,否则会在第四步出现openssl header 和openssl lib 版本不一致的错误

多次输入命令: ldd /usr/bin/openssl 找到 libssl 和 libcrypto 所在路径,并删除它们,直到没有

(参考:http://askubuntu.com/questions/830466/libcrypto-so-1-0-0-no-version-information-available-required-by-ssh)

tar zxvf openssl-1.0.2k.tar.gz   (或者 git checkout OpenSSL_1_0_2k)
cd openssl-1.0.2k

./config --prefix=/usr/ --openssldir=/usr/ shared

make clean

make && make install

用 openssl version 命令可查看openssl的版本,成功后输入以下命令

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

ln -s /usr/local/ssl/include/openssl /usr/include/openssl

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

4、编译安装openssh
tar zxvf openssh-7.5p1.tar.gz
cd openssh-7.5p1
./configure --with-zlib --with-ssl-dir --with-pam --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc/ssh

make clean

make && make install

完成后查看ssh版本。ssh -V查看

原文地址:https://www.cnblogs.com/ldybyz/p/6699779.html