ubuntu-22.04.4编译升级安装 OpenSSH_9.8p1+OpenSSL 3.3.2+zlib1.3.1
实验镜像
ubuntu-22.04.4-live-server-amd64.iso
# 安装必备和常用软件包
# 安装相关的依赖项,如有遗漏再次安装
apt install -y gcc gcc-c++ zlib-devel libtool autoconf automake perl perl-IPC-Cmd perl-Data-Dumper perl-CPAN
# 安装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