Linux(银河麒麟)升级openssh和openssl

Linux升级openssh

升级包下载地址:

openssh:https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz

openssl:https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz

zlib:https://zlib.net/fossils/zlib-1.3.tar.gz

备份原文件

cp /usr/include/openssl .
cp /usr/bin/openssl .
cp /usr/sbin/sshd .
cp /usr/bin/ssh* .
mv /etc/ssh /etc/sshbak

下载所需依赖

sudo yum install openssl-devel zlib-devel perl vim gcc make pam-devel

安装zlib

tar -xvf zlib-1.3.tar.gz
cd zlib-1.3
./configure --prefix=/usr/local/zlib
make -j 8 && make install

安装openssl

tar -xvf openssl-3.3.2.tar.gz
cd /openssl-3.3.2
./config --prefix=/usr/local/openssl
make -j 8 && make install
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/lib64/libssl.so.3 /usr/lib64/
ln -s /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib64/

安装openssh

tar -xvf openssh-9.8p1.tar.gz
cd /openssh-9.8p1
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/openssl --with-pam --without-openssl-header-check
make -j 8 && 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 daemon-reload && systemctl restart sshd

sshd -V
OpenSSH_9.8p1, OpenSSL 3.3.2 3 Sep 2024

image-20240926162808934

posted @ 2024-10-22 22:12  niumayang  阅读(770)  评论(0编辑  收藏  举报