mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
yum clean all
编译安装zlib:
cd /usr/local/src/upgrade-openssh
yum localinstall -y --skip-broken /usr/local/src/offline-package/*.rpm
tar xf zlib-1.2.13.tar.gz
cd /usr/local/src/upgrade-openssh/zlib-1.2.13
./configure --prefix=/usr/local/zlib
make&&makeinstall
编译安装openssl:
cd /usr/local/src/upgrade-openssh
tar xf openssl-1.1.1t.tar.gz
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/include/openssl /usr/include/openssl.old
cd /usr/local/src/upgrade-openssh/openssl-1.1.1t
./config --prefix=/usr/local/openssl
cd openssl-1.1.1t/7
./config --prefix=/usr/local/openssl
make&&makeinstallln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
echo"/usr/local/openssl/lib">> /etc/ld.so.conf
ldconfig -v
#验证
openssl version
编译安装openssh:
tar xf openssh-9.3p1.tar.gz
cd /usr/local/src/upgrade-openssh/openssh-9.3p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib --without-hardening
make&&makeinstallecho"PermitRootLogin yes">> /etc/ssh/sshd_config
echo"UseDNS no">> /etc/ssh/sshd_config
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
chmod +x /etc/init.d/sshd
chkconfig --add sshd
systemctl enable sshd
chkconfig sshd on
mv /usr/lib/systemd/system/sshd.service /tmp
chmod600 /etc/ssh/ssh_host_ecdsa_key
chmod600 /etc/ssh/ssh_host_ed25519_key
chmod600 /etc/ssh/ssh_host_rsa_key
sed -i 's/GSSAPIAuthentication/#GSSAPIAuthentication/g' /etc/ssh/ssh_config
sed -i 's/GSSAPIAuthentication/#GSSAPIAuthentication/g' /etc/ssh/sshd_config
systemctl daemon-reload
systemctl restart sshd
#验证ssh -V
make编译报错1:
/usr/bin/ld: cannot find -lz collect2: error: ld returned 1exit status
undefined reference to `BIO_f_zlib‘ openssl编译报错
解决:
make clean //清除上次的make命令所产生的object文件
make // 重新编译
make编译报错2:
configure: error: *** zlib.h missing - please install first or check config.
解决
安装zlib或者编译时指定zlib
yum -y install zlib
--with-zlib/usr/local/zlib