1. 程式人生 > 實用技巧 >Centos7升級openssh

Centos7升級openssh

1、檢視當前版本

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[root@localhost ~]# ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013
[root@localhost ~]# 

2、下載zlib、openssl、openssh最新安裝包

[root@localhost ~]# ls
anaconda-ks.cfg  openssh-8.3p1.tar.gz  openssl-1.1.1f.tar.gz  zlib-1.2.11.tar.gz

3、安裝編譯所需工具包

yum -y install gcc pam-devel zlib-devel perl

4、安裝zlib

[root@localhost ~]# tar -zxvf zlib-1.2.11.tar.gz
[root@localhost ~]# cd zlib-1.2.11/
[root@localhost zlib-1.2.11]# ./configure && make && make install

5、安裝openssl

[root@localhost ~]# tar -zxvf openssl-1.1.1f.tar.gz
[root@localhost ~]# cd openssl-1.1.1f/
[root@localhost openssl-1.1.1f]# ./config && make && make install

6、檢視openssl版本(由於openssl庫的位置不正確造成無法載入)

[root@localhost ~]# openssl version
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
[root@localhost ~]# 

7、建立openssl庫檔案連結

[root@localhost ~]# ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[root@localhost ~]# ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

8、再次檢視openssl版本(已經升級成功)

[root@localhost ~]# openssl version
OpenSSL 1.1.1f  31 Mar 2020

9、安裝openssh

[root@localhost ~]# tar -zxvf openssh-8.3p1.tar.gz 
[root@localhost ~]# cd openssh-8.3p1/
[root@localhost openssh-8.3p1]# ./configure && make && make install

10、檢視openssh版本(升級成功)

[root@localhost ~]# ssh -V
OpenSSH_8.3p1, OpenSSL 1.1.1f  31 Mar 2020
[root@localhost ~]#