安裝OpenSsh8.1+LibreSSL 3.0.2(ssh升級)


 

zlib下載地址:  http://www.zlib.net/
LibreSSL下載地址: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/
OpenSSH下載地址:  http://mirror.aarnet.edu.au/pub/OpenBSD/OpenSSH/portable/

 

rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -ivh gmp-devel-4.3.1-7.el6_2.2.x86_64.rpm 
rpm -ivh mpfr-devel-2.4.1-6.el6.x86_64.rpm

  

1、安裝zlib

tar -xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
 ./configure --prefix=/usr/local/zlib-1.2.11
 make && make install

如果需要升級ntp的話,一定要再升級ssl前升級ntp,否則會報如下錯誤:

 

 

libsntp.a(crypto.o): In function `compute_mac':
/usr/local/ntp-4.2.8p13/sntp/crypto.c:79: undefined reference to `EVP_MD_CTX_new'
/usr/local/ntp-4.2.8p13/sntp/crypto.c:117: undefined reference to `EVP_MD_CTX_free'
collect2: ld returned 1 exit status
make[4]: *** [sntp] 錯誤 1
make[4]: Leaving directory `/usr/local/ntp-4.2.8p13/sntp'
make[3]: *** [all-recursive] 錯誤 1
make[3]: Leaving directory `/usr/local/ntp-4.2.8p13/sntp'
make[2]: *** [all] 錯誤 2
make[2]: Leaving directory `/usr/local/ntp-4.2.8p13/sntp'
make[1]: *** [all-recursive] 錯誤 1
make[1]: Leaving directory `/usr/local/ntp-4.2.8p13'
make: *** [all] 錯誤 2

  

2、安裝libressl

千萬不要刪除舊版本的openssl,有可能導致yum無法正常使用。

cd libressl-3.0.2
./configure --prefix=/usr/local
make
make install

 libressl代替openssl

vim /etc/ld.so.conf.d/local.conf  #新建local.conf文件,添加下面一行
     /usr/local/lib   # 將 /usr/local/lib 目錄加入到模塊加載目錄。
 
ldconfig -v   #重新加載共享模塊:
openssl version #查看版本

安裝openssh

#--with-ssl-dir  指定ssl的安裝目錄  
#--with-zlib  指定zlib的安裝目錄
./configure --prefix=/usr/local/openssh-8.1p1 --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local --with-zlib=/usr/local/zlib-1.2.11 --with-md5-passwords
make
make  install 

cd /etc/init.d/
mv sshd sshd.bak
cd /usr/local/openssh-8.1p1/contrib/redhat/
cp -p sshd.init /etc/init.d/sshd
vi /etc/init.d/sshd
SSHD=/usr/local/openssh-8.1p1/sbin/sshd     #25行   SSHD=/usr/sbin/sshd
/usr/local/openssh-8.1p1/bin/ssh-keygen -A  #41行 /usr/bin/ssh-keygen -A 
chkconfig --add sshd
chkconfig sshd on
chkconfig --list sshd
service sshd restart

vim /etc/profile
export PATH=/usr/local/openssh-8.1p1/bin:$PATH

  

  

CentOS7(RedHat7)需要再做以下操作。

將systemctl下的原ssh相關文件移走,將不然升級后的openssh不兼容。

mv /usr/lib/systemd/system/ssh*  /opt

vi /etc/ssh/sshd_config   //增加下一行 

PermitRootLogin yes

service sshd restart
vi /etc/profile 或者  ~/.bash_profile  設置PATH變量

export PATH=/usr/local/openssh-8.1p1/sbin:/usr/local/openssh-8.1p1/bin:$PATH

source /etc/profile

 驗證:

ssh -V
openssl  version

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM