麒麟系统升级openssh至9.5p1

发布时间 2023-12-28 15:39:39作者: xjournal

当前环境:

升级openssh需要三个包zlib-1.2.13.tar.gz、openssl-1.1.1t.tar.gz、openssh-9.5p1.tar.gz

下载地址:

zlib-1.2.13.tar.gz http://zlib.net/fossils/zlib-1.2.13.tar.gz  

openssl-1.1.1t.tar.gz https://www.openssl.org/source/old/1.1.1/openssl-1.1.1t.tar.gz

openssh-9.5p1.tar.gz https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/openssh-9.5.tar.gz

开始安装

安装顺序zlib->openssl->openssh

//安装 zlib
tar zxvf zlib-1.2.13.tar.gz
cd zlib-1.2.13
./configure --prefix=/usr/local/zlib
make && make install
//安装 openssl
cd ..
tar zxvf openssl-1.1.1t.tar.gz
cd openssl-1.1.1t
./config --prefix=/usr/local/ssl -d shared
make && make install
echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
//安装 openssh
cd ..
yum -y remove openssh
tar zxvf openssh-9.5p1.tar.gz
cd openssh-9.5p1	
./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl --without-openssl-header-check
make && make install
//配置
echo 'PermitRootLogin yes' >> /usr/local/openssh/etc/sshd_config
echo 'PubkeyAuthentication yes' >> /usr/local/openssh/etc/sshd_config
echo 'PasswordAuthentication yes' >> /usr/local/openssh/etc/sshd_config
cd contrib/redhat/
cp sshd.init  /etc/init.d/sshd
chkconfig --add sshd
cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config 
cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
cp /usr/local/openssh/bin/ssh /usr/bin/ssh
cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
\cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
systemctl start sshd.service
chkconfig --add sshd
chkconfig sshd on

 安装完成后