网站首页 > 精选文章 / 正文
注意:
1、cento要升级到7.9
2、openssh要下载p1版本
1.基础准备
1.1 下载openssh-9.2p1.tar.gz安装包:
阿里云下载地址:
https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/ (注意:要下载p1版,此版为编译安装包)
1.2 下载 openssl
官方下载地址:
https://www.openssl.org/source/openssl-1.1.1t.tar.gz (速度可以)
1.3 下载zlib,
Gethub,下载地址:
https://github.com/madler/zlib/releases/tag/v1.2.13(官网没有V1.1.1
2.检查环境
openssl version -a 查看openssl版本
ssh -V 查看SSH版本
cat /etc/redhat-release 查看版本
3.安装步骤
3.1、解压
tar -xzf openssh-9.2p1.tar.gz
tar -xzf openssl-1.1.1t.tar.gz
tar -xzf zlib-1.2.13.tar.gz
3.2、编译安装zlib
cd zlib-1.2.13
./configure --prefix=/usr/local/zlib
make && make install
echo '/usr/local/zlib/lib' >> /etc/ld.so.conf
ldconfig -v
编译zlib出错,请安装gcc
yum install gcc
gcc --version
3.3、编译安装openssl
cd openssl-1.1.1t
./config --prefix=/usr/local/ssl -d shared
make && make install (时间比较长,切勿打断)
echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
ldconfig -v
3.4、升级openSSH(建议开两个终端,防止升级中途断开无法连上)
cd openssh-9.2p1
./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl
make && make install
3.5、配置ssh
echo 'PermitRootLogin yes' >>/usr/local/openssh/etc/sshd_config
echo 'PubkeyAuthentication yes' >>/usr/local/openssh/etc/sshd_config
echo 'PasswordAuthentication yes' >>/usr/local/openssh/etc/sshd_config
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
mv /usr/sbin/sshd /usr/sbin/sshd.bak
cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
mv /usr/bin/ssh /usr/bin/ssh.bak
cp /usr/local/openssh/bin/ssh /usr/bin/ssh
mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak
cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak
cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
cp -p contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
chmod 600 /etc/ssh/ssh_host_rsa_key
chmod 600 /etc/ssh/ssh_host_ecdsa_key
chown -R root.root /var/empty/sshd
chmod 744 /var/empty/sshd
4、重启服务
登录后复制
重启sshd服务
systemctl restart sshd
查看sshd服务状态
systemctl status sshd -l
验证ssh版本
ssh -V
Tags:centos 9
猜你喜欢
- 2025-06-23 Ambari(HDP)单机部署(ambari安装hadoop)
- 2025-06-23 centos7安装SVN(centos7安装rpm软件)
- 2025-06-23 vSphere8超融合部署综合实验(vmware vsan超融合企业应用实战)
- 2025-06-23 打通数据高速公路:如何在 CentOS 上使用 Thunderbolt 3 和 4
- 2025-06-23 CentOS 7.9,二分钟搭建好MySQL8.0-PXC集群(实操不说原理)
- 2025-06-23 CentOS 7下Yum及RPM安装GitLab CE 14.0.3
- 2025-06-23 5分钟理解Centos7防火墙firewalld
- 2025-06-23 CentOS替代之路:Rocky Linux 9.1 安装简易教程
- 2025-06-23 CentOS 操作系统常用命令详解(centos命令大全及用法)
- 2025-06-23 基于Centos7.9部署zabbix5.0(centos 7 bbr)