基于centos7的Openssh版本升级

一、环境准备

yum -y install wget tar gcc make

二、上传升级的软件包

zlib-1.2.11.tar.gz,openssl-1.1.1d .tar.gz,openssh-9.0p1.tar.gz
下载地址:

zlib:
官网http://www.zlib.net/
wget https://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz
openssl:
wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
openssh:
https://mirrors.sonic.net/pub/OpenBSD/OpenSSH/portable/

上传到服务器并解压
三、安装libz

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

四、安装openssl

cd openssl-1.1.1d
./config --prefix=/usr/local/ssl -d shared
make && make install
echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
ldconfig -v

五、安装openssh-9.0

cd openssh-9.0
./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl
make && make install

六、卸载yum安装的openssh

yum remove openssh

七、修改配置
启动前要将新生成的sshd_config修改以下几个地方

vim /usr/local/openssh/etc/sshd_config
PermitRootLogin yes
PubkeyAuthentication yes
PasswordAuthentication yes

复制文件到相应的系统文件夹

[root@pig4cloud openssh-9.0p1]# cd /usr/local/src/openssh-9.0p1/contrib/redhat
[root@pig4cloud redhat]# cp sshd.init  /etc/init.d/sshd 
[root@pig4cloud redhat]# chkconfig --add sshd
[root@pig4cloud redhat]# cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
[root@pig4cloud redhat]# cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
[root@pig4cloud redhat]# cp /usr/local/openssh/bin/ssh /usr/bin/ssh
[root@pig4cloud redhat]# cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
[root@pig4cloud redhat]# cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub

[root@pig4cloud redhat]#

重启sshd服务

systemctl start sshd.service
#查看版本
[root@pig4cloud redhat]# ssh -V
OpenSSH_9.0p1, OpenSSL 1.1.1d  10 Sep 2019
  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值