https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/
官网到这里看看最新版是多少,换掉下面的命令

http://www.zlib.net/zlib-1.2.11.tar.gz
https://www.openssl.org/source/openssl-1.1.1.tar.gz
这是他的两个依赖,openssl不同系统对应能装的版本不一样,请注意,Ubuntu用的也就是上面这两个版本,所以不需要装

现在举安装OpenSSH的例子,依赖也是一样的,如果更新依赖那么依赖要先装

wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.9p1.tar.gz
tar -xzvf openssh-8.9p1.tar.gz
cd openssh-8.9p1.tar
./configure
make
make install

好了,这样就装好了,但是系统自带的ssh需要处理掉,因为系统自带的装在/usr/bin而编译的装在/usr/local/bin

rm /usr/bin/ssh
rm /usr/bin/ssh-add
rm /usr/bin/ssh-agent
rm /usr/bin/ssh-argv0
rm /usr/bin/ssh-copy-id
rm /usr/bin/ssh-import-id
rm /usr/bin/ssh-import-id-gh
rm /usr/bin/ssh-import-id-lp
rm /usr/bin/ssh-keygen
rm /usr/bin/ssh-keyscan
rm /usr/sbin/sshd
ln -s /usr/local/bin/ssh /usr/bin/ssh
ln -s /usr/local/bin/ssh-add /usr/bin/ssh-add
ln -s /usr/local/bin/ssh-agent /usr/bin/ssh-agent
ln -s /usr/local/bin/ssh-argv0 /usr/bin/ssh-argv0
ln -s /usr/local/bin/ssh-copy-id /usr/bin/ssh-copy-id
ln -s /usr/local/bin/ssh-import-id /usr/bin/ssh-import-id
ln -s /usr/local/bin/ssh-import-id-gh /usr/bin/ssh-import-id-gh
ln -s /usr/local/bin/ssh-import-id-lp /usr/bin/ssh-import-id-lp
ln -s /usr/local/bin/ssh-keygen /usr/bin/ssh-keygen
ln -s /usr/local/bin/ssh-keyscan /usr/bin/ssh-keyscan
ln -s /usr/local/sbin/sshd /usr/sbin/sshd