升級Ubuntu16.04和CentOS7.4的openSSL和openSSH

Ubuntu 16.04.4 LTS


安裝依賴包保平安

apt-get install root-system-bin autoconf automake make build-essential libpam0g-dev gcc libpcre3 libpcre3-dev zlib1g-dev libssl-dev libbz2-dev

下載的壓縮包放在opt目錄

cd /opt/

wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz

wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-7.7p1.tar.gz

解壓

tar zxf openssl-1.0.2o.tar.gz

tar zxf openssh-7.7p1.tar.gz


進(jìn)入openssl源碼目錄

cd openssl-1.0.2o/

./config shared zlib???? #加上shared參數(shù)是生成共享庫文件,不然后邊源碼安裝openssl的時候會提示找不到文件

make -j $(cat /proc/cpuinfo| grep "processor"|wc -l) && make install

mv /usr/bin/openssl /root/??? #移動原來的openssl執(zhí)行文件到用戶目錄,這個可以隨意放

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl???? #新版的openssl做個軟鏈

openssl version???? #如果版本顯示為新版則大功告成


刪除/lib/x86_64-linux-gnu路徑下舊版的libssl.so.1.0.0和libcrypto.so.1.0.0文件

rm -f /lib/x86_64-linux-gnu/libssl.so.1.0.0 && rm -f?/lib/x86_64-linux-gnu/libcrypto.so.1.0.0

軟鏈個新版的

ln -s /usr/local/ssl/lib/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so.1.0.0 && ln -s /usr/local/ssl/lib/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0

引擎目錄同理

mv /usr/lib/x86_64-linux-gnu/openssl-1.0.0/engines/ /usr/lib/x86_64-linux-gnu/openssl-1.0.0/engines.old/

?ln -s /usr/local/ssl/lib/engines /usr/lib/x86_64-linux-gnu/openssl-1.0.0/engines


好,繼續(xù)安裝新版ssh

cd /opt/openssh-7.7p1/

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-ssl-dir=/usr/local/ssl --with-zlib=/usr/local/include

make -j $(cat /proc/cpuinfo| grep "processor"|wc -l) && make install

ssh -V??? #如版本顯示為新版本則大功告成


ubuntu 16.04的升級完畢


CentOS 7.5.1804



安裝依賴包保平安

yum install pam-devel tcp_wrappers-devel make pam autoconf automake gcc c++ zlib-devel.x86_64 openssl-devel.x86_64

cd /opt/

wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz

wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-7.7p1.tar.gz

wget https://www.openssl.org/source/openssl-fips-2.0.16.tar.gz

tar zxf openssl-1.0.2o.tar.gz

tar zxf openssh-7.7p1.tar.gz

tar zxf openssl-fips-2.0.16.tar.gz


源碼安裝openssl-fips,據(jù)說這個可以提高openssl的性能,ubuntu上也可以用,但是這里我只在CentOS上安裝。

cd openssl-fips-2.0.16

./config shared zlib??? #shared參數(shù)生成動態(tài)庫

make -j $(cat /proc/cpuinfo| grep "processor"|wc -l) && make install


源碼安裝openssl,我這里直接指定到系統(tǒng)原openssl的安裝目錄,直接覆蓋。

cd openssl-1.0.2o

./config fips shared --prefix=/usr threads zlib

make depend

make -j $(cat /proc/cpuinfo| grep "processor"|wc -l) && make install


源碼安裝openssh,我這里直接指定到系統(tǒng)原openssh的安裝目錄,直接覆蓋。

cd openssh-7.7p1

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-ssl-dir=../openssl-1.0.2o --with-zlib=/usr/local/include

make -j $(cat /proc/cpuinfo| grep "processor"|wc -l) && make install

ssh -V??? #如版本顯示為新版本則大功告成

OK,就這么簡單。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容