linux环境下 centos7.8 openssh 7.4p1 升级最新版本 openssh 9.7p1

本文详细描述了在CentOS7.8系统上升级旧版OpenSSH和安装最新openssl版本的过程,包括移除旧版本、配置新组件、添加安全设置并启动服务。
摘要由CSDN通过智能技术生成

1查看版本

[root@VM-0-15-centos ~]# cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)
[root@VM-0-15-centos ~]# 
[root@VM-0-15-centos ~]# rpm  -qa|  grep  openssh
openssh-7.4p1-21.el7.x86_64
openssh-clients-7.4p1-21.el7.x86_64
openssh-server-7.4p1-21.el7.x86_64
[root@VM-0-15-centos ~]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

2安装openssl 和zalib

tar  zxvf  openssl-1.1.1w.tar.gz
cd openssl-1.1.1w/
./config  --prefix=/usr/local/ssl
make
make install
echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
ldconfig -v
[root@VM-0-15-centos ~]# /usr/local/ssl/bin/openssl version
OpenSSL 1.1.1w  11 Sep 2023
#zlib
tar xvf zlib-1.3.tar.xz
cd zlib-1.3/
./configure --prefix=/usr/local/zlib
make
make install

3 下载openssh 和安装

wget  https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.7p1.tar.gz  .
[root@VM-0-15-centos ~]# rpm  -qa|  grep  openssh
openssh-7.4p1-21.el7.x86_64
openssh-clients-7.4p1-21.el7.x86_64
openssh-server-7.4p1-21.el7.x86_64
[root@VM-0-15-centos ~]# rpm  -e openssh-7.4p1-21.el7.x86_64  --nodeps
[root@VM-0-15-centos ~]# rpm  -e openssh-clients-7.4p1-21.el7.x86_64  --nodeps
[root@VM-0-15-centos ~]# rpm  -e openssh-server-7.4p1-21.el7.x86_64  --nodeps
warning: /etc/ssh/sshd_config saved as /etc/ssh/sshd_config.rpmsave
#再次查询确认
[root@VM-0-15-centos ~]# rpm  -qa|  grep  openssh
tar  zxvf openssh-9.7p1.tar.gz
cd openssh-9.7p1/
./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl
make
make install
sed -i 's/^#UseDNS.*/UseDNS no/' /usr/local/openssh/etc/sshd_config
sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /usr/local/openssh/etc/sshd_config
sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication yes/' /usr/local/openssh/etc/sshd_config
sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /usr/local/openssh/etc/sshd_config
vim  /usr/local/openssh/etc/sshd_config#底部增加
HostKeyAlgorithms +ssh-rsa,ssh-dss
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1
#拷贝到环境
cp  /usr/local/openssh/sbin/sshd /usr/sbin/
cp  /usr/local/openssh/bin/ssh  /usr/bin/
cp  /usr/local/openssh/bin/ssh-keygen  /usr/bin/
cp /usr/local/openssh/bin/sftp /usr/bin/
cp  /usr/local/openssh/bin/scp  /usr/bin/
cp  -a  contrib/redhat/sshd.init /etc/init.d/sshd
#启动
chmod u+x  /etc/init.d/sshd
/etc/init.d/sshd  start
#查看
[root@VM-0-15-centos ~]# ssh  -V
OpenSSH_9.7p1, OpenSSL 1.1.1w  11 Sep 2023

 

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值