由 SuKai November 19, 2024
下载包
wget --no-check-certificate https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.9p1.tar.gz
安装编译环境
sudo yum groupinstall -y "Development Tools"
sudo yum install -y rpmdevtools imake libXt-devel gtk2-devel
sudo yum install -y zlib-devel pam-devel krb5-devel
编译安装
tar xf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config shared zlib -fPIC --prefix=/usr/local/openssl
make -j 4
sudo make install
cd /opt/software/openssh-9.9p1
./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl --with-zlib
make -j 4
sudo make install
sudo cp contrib/redhat/sshd.init /etc/init.d/sshd
vi /usr/local/openssh/etc/sshd_config
PermitRootLogin yes
PubkeyAuthentication yes
安装前和安装后操作
sudo mv /usr/bin/openssl /usr/bin/openssl.bak
sudo ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
sudo ln -s /usr/local/openssl/include/openssl /usr/include/openssl
sudo echo '/usr/local/openssl/lib' > /etc/ld.so.conf.d/openssl-x86_64.conf
sudo ldconfig -v
sudo openssl version -a
sudo mv /etc/ssh /etc/ssh.bak
sudo mv /usr/sbin/sshd /usr/sbin/sshd.bak
sudo mv /usr/bin/ssh /usr/bin/ssh.bak
sudo rpm -qa|grep openssh
sudo rpm -e openssh-clients --nodeps
sudo rpm -e openssh-server
sudo rpm -e openssh-7.4p1
sudo rpm -qa|grep openssh
sudo ls /usr/lib/systemd/system/ssh*
sudo cp /home/centos/sshd.init /etc/init.d/sshd
sudo mkdir /etc/ssh
sudo cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
sudo cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
sudo cp /usr/local/openssh/bin/ssh /usr/bin/ssh
sudo cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
sudo cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
sudo systemctl daemon-reload
sudo systemctl start sshd
sudo systemctl enable sshd
sudo cp /usr/local/openssh/bin/* /usr/bin/