欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Centos7如何升級(jí)openssl和openssh最新版

 更新時(shí)間:2025年06月08日 16:18:56   作者:Aspire?to?freedom  
這篇文章主要介紹了Centos7如何升級(jí)openssl和openssh最新版的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

1、事前準(zhǔn)備

下載openssl3.4.1和openssh9.9p2壓縮包上傳到服務(wù)器

https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable//

Release OpenSSL 3.4.1 · openssl/openssl · GitHub

2、查看centos7、ssh以及openssl的版本信息

# 查看CentOS系統(tǒng)版本信息
cat /etc/redhat-release
# 查看openssl版本信息
openssl version
# 查看openssh的版本信息
ssh -V

3、安裝依賴

yum -y install gcc pam-devel zlib-devel openssl-devel net-tools
yum install -y perl-IPC-Cmd perl-Data-Dumper

4、安裝openssl-3.4.1版本

(1)解壓openssl-3.4.1壓縮包

tar zxvf openssl-3.4.1.tar.gz -C /usr/local/
cd /usr/local/openssl-3.4.1/
mkdir /opt/openssl

(2)編譯安裝openssl-3.4.1

./config --prefix=/opt/openssl
make -j4 && make install   ###-j后面的數(shù)字為你的內(nèi)核數(shù)

(3)更新lib文件

ldd /opt/openssl/bin/openssl
echo "/opt/openssl/lib" >> /etc/ld.so.conf
echo "/opt/openssl/lib64" >> /etc/ld.so.conf
echo "/usr/local/openssl-3.4.1" >> /etc/ld.so.conf
ldconfig -v
ldd /opt/openssl/bin/openssl

(4)更新bin文件

# 查看舊版本的openssl命令路徑
which openssl
# 重命名為openssl.old
mv /usr/bin/openssl /usr/bin/openssl.old   #重命名openssl文件
# 使用軟連接的方式更新openssl命令
ln -s /opt/openssl/bin/openssl /usr//bin/openssl
# openssl命令查看版本呢
openssl version

5、編譯安裝openssh9.9p2

(1)解壓縮openssh9.9p2壓縮包

# 卸載openssh的rpm包
for i in $(rpm -qa | grep openssh);do rpm -e $i --nodeps;done
# 解壓縮openssh9.7p1包到目標(biāo)目錄
cd ~
tar zvxf openssh-9.9p2.tar.gz -C /usr/local/
# 進(jìn)入openssh9.7p1的源碼目錄
cd /usr/local/openssh-9.9p2/
# 安裝前查看一下安裝文件INSTALL(建議看一下)
more INSTALL

(2)編譯安裝openssh9.9p2

# 配置編譯和安裝過程,"--prefix=" 配置安裝目錄,"--sysconfdir=" 配置文件路徑,"--with-ssl-dir=" openssl的安裝路徑
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/opt/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib --without-hardening

chmod 600 /etc/ssh/ssh_host_*_key
chown root:root /etc/ssh/ssh_host_*_key

make -j4 && make install

(3)復(fù)制并修改啟動(dòng)sshd.init腳本

# 從源碼目錄下復(fù)制sshd.init到/etc/init.d/
cp /usr/local/openssh-9.9p2/contrib/redhat/sshd.init /etc/init.d/

## 查看并修改SSHD的新路徑,將新的openssh安裝路徑更新
cat /etc/init.d/sshd.init | grep SSHD
sed -i "s/SSHD=\/usr\/sbin\/sshd/SSHD=\/usr\/local\/openssh\/sbin\/sshd/g" /etc/init.d/sshd.init
cat /etc/init.d/sshd.init | grep SSHD

## 查看并修改ssh-keygen的新路徑,將新的ssh-keygen安裝路徑更新
cat -n /etc/init.d/sshd.init | grep ssh-keygen
sed -i "s#/usr/bin/ssh-keygen -A#/usr/local/openssh/bin/ssh-keygen -A#g" /etc/init.d/sshd.init
cat -n /etc/init.d/sshd.init | grep ssh-keygen

(4)修改配置文件(sshd_config)

# 開啟允許X11轉(zhuǎn)發(fā)
echo 'X11Forwarding yes' >> /etc/ssh/sshd_config 
# 開啟允許密碼驗(yàn)證
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config 

(5)啟動(dòng)openssh,并設(shè)置開機(jī)啟動(dòng)

# 復(fù)制ssh的相關(guān)命令
cp -arp /usr/local/openssh/bin/* /usr/bin/
# 啟動(dòng)sshd服務(wù)
/etc/init.d/sshd.init start
# 查看版本
ssh -V
# 添加開機(jī)啟動(dòng)
chmod +x /etc/rc.d/rc.local
echo "/etc/init.d/sshd.init start" >> /etc/rc.d/rc.local  
systemctl enable --now rc-local

(6)測(cè)試openssh連接

使用ssh協(xié)議連接centos7,檢查openssh9.9p2服務(wù)

重啟系統(tǒng)后ssh協(xié)議登錄centos7,檢查openssh9.9p2自動(dòng)啟動(dòng)

6、檢查系統(tǒng)、openssl和openssh的版本信息

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論