龙蜥8.8openssh升级步骤
1.查看目前openssh版本
rpm -qa|grep openssh
2.安装rpm包制作需要的工具
dnf install rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel libXt-devel gtk2-devel make perl -y
dnf install imake -y
3.官网下载openssh源码包
https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.5p1.tar.gz
https://src.fedoraproject.org/repo/pkgs/openssh/x11-ssh-askpass-1.2.4.1.tar.gz/8f2e41f3f7eaa8543a2440454637f3c3/x11-ssh-askpass-1.2.4.1.tar.gz
4.环境初始化准备
mkdir -p /root/rpmbuild/SOURCES
cp openssh-9.4p1.tar.gz /root/rpmbuild/SOURCES
cp x11-ssh-askpass-1.2.4.1.tar.gz /root/rpmbuild/SOURCES/
tar -zxf openssh-9.4p1.tar.gz
mkdir -p /root/rpmbuild/SPECS/
cd /root/rpmbuild/SOURCES/openssh-9.4p1
cp ./contrib/redhat/openssh.spec /root/rpmbuild/SPECS/
rpmbuild -ba openssh.spec
报错"openssl-devel < 1.1 被 openssh-9.4p1-1.el8.bclinux.x86_64 需要 "解决方法:
cd /root/rpmbuild/SPECS/
vi openssh.spec
注释如下行
#BuildRequires: openssl-devel < 1.1
5.rpm 打包
rpmbuild -ba openssh.spec
报错Package 'libpcre2-8', required by 'libselinux', not found解决方法:
yum install pcre2-devel.x86_64
6.查看rpm包
ls -lrth /root/rpmbuild/RPMS/x86_64/
7.openssh升级准备
cd /root/rpmbuild/RPMS/x86_64/
cp openssh-clients-9.4p1-1.an8.x86_64.rpm /data/openssh/
cp openssh-9.4p1-1.an8.x86_64.rpm /data/openssh/
cp openssh-server-9.4p1-1.an8.x86_64.rpm /data/openssh/
#配置文件备份
cp /etc/ssh/sshd_config /etc/ssh/sshd_config20230928
cp /etc/pam.d/sshd /etc/pam.d/sshd20230928
8.开始升级
cd /data/openssh
dnf localinstall *.rpm
ssh -v
#确认如下文件的权限为0600,如果不是,请修改为0600
ssh_host_ed25519_key 、ssh_host_ecdsa_key、ssh_host_rsa_key
#因rpm安装会覆盖之前的配置文件,所以通过备份的pam文件还原
cat /etc/pam.d/sshd20230928 >/etc/pam.d/sshd
#服务重启
service sshd restart