基于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
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 J.のblog!
评论