实验镜像
ubuntu-22.04.4-live-server-amd64.iso
# 安装必备和常用软件包
# 安装相关的依赖项,如有遗漏再次安装
apt install -y libz-dev vim gcc wget tar lrzsz nano make net-tools
# 安装zlib
./configure --prefix=/usr/local/zlib make && make install
# 安装openssl
./config --prefix=/usr/local/openssl make && echo $? #输出0则代表没有错误 make -j 4 install
# 覆盖创建软链接
ln -sf /usr/local/openssl/include/openssl /usr/include/openssl
ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -sf /usr/local/openssl/lib64/libssl.so.3 /usr/lib/x86_64-linux-gnu//libssl.so.3
ln -sf /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib/x86_64-linux-gnu/libcrypto.so.3
# 验证版本
openssl version -a
# 安装openssh
mv /etc/ssh /etc/ssh.bak
./configure --prefix=/usr/local/openssh/ --sysconfdir=/etc/ssh/ --with-ssl-dir=/usr/local/openssl/ --with-zlib=/usr/local/zlib/ --without-openssl-header-check make -j 4 && make install
# 从安装目录创建软连接到系统目录
ln -sf /usr/local/openssh/sbin/sshd /sbin/sshd ln -sf /usr/local/openssh/bin/ssh /usr/bin/ssh ln -sf /usr/local/openssh/bin/scp /usr/bin/scp ln -sf /usr/local/openssh/bin/sftp /usr/bin/sftp ln -sf /usr/local/openssh/bin/ssh-add /usr/bin/ssh-add ln -sf /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen ln -sf /usr/local/openssh/bin/ssh-keyscan /usr/bin/ssh-keyscan
# 验证
systemctl status sshd
sshd -V
标签:bin,p1,OpenSSH,OpenSSL,openssl,usr,local,sf,ssh From: https://www.cnblogs.com/jianxiaoxiu/p/18412623