安裝包下載
cd ~
wget http://www.zlib.net/zlib-1.2.11.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.4p1.tar.gz
依賴包
yum install -y openssl-devel zlib-devel gcc perl-Test-Harness pam-devel
安裝zlib
cd ~
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure
make && make install
安裝openssl
cd ~
tar -zxvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g/
./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl
make && make install
./config shared --prefix=/usr/local/openssl --openssldir=/usr/local/ssl
make clean
make && make install
echo "/usr/local/ssl" >> /etc/ld.so.conf && ldconfig #模塊加載
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1 #庫加載
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1 #庫加載
安裝openssh
cd ~
cp -r /etc/ssh/ /etc/ssh_bak #配置文件備份
tar -zxvf openssh-8.4p1.tar.gz
cd openssh-8.4p1
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh2 --with-ssl-dir=/usr/local/openssl/ --without-openssl-header-check --with-md5-passwords --with-pam --with-tcp-wrappers --without-hardening
make && rpm -e --nodeps `rpm -qa | grep openssh` #make 成功后,刪除舊版ssh
make install
環(huán)境變量恢復(fù)
cd ~/openssh-8.4p1
cp contrib/redhat/sshd.init /etc/init.d/sshd
chmod u+x /etc/init.d/sshd
chkconfig --add sshd
ln -s /usr/local/openssh/sbin/sshd /usr/sbin/sshd
ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh
ln -s /usr/local/openssh/bin/ssh-agent /usr/bin/ssh-agent
ln -s /usr/local/openssh/bin/scp /usr/bin/scp
ln -s /usr/local/openssh/bin/ssh-add /usr/bin/ssh-add
#配置sshd配置文件(配置文件位置位于/etc/ssh2目錄下,舊版本的配置文件與新版本不太兼容)
cat >> /etc/ssh2/sshd_config << EOF
PermitEmptyPasswords no
Protocol 2
PermitRootLogin yes
passwordAuthentication yes
UseDNS no
X11Forwarding yes
PermitRootLogin yes
EOF
啟動sshd
service sshd start
重啟驗證
shutdown -r now
檢驗版本
ssh -V
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。