OpenSSH 9.2P1 aarch64 编译RPM包及升级处理过程
本文参考了:OpenSSH 9.2P1升级以及版本显示的处理过程 - 济南小老虎 - 博客园 (cnblogs.com)
openssh源码编译打包成rpm(openssh-8.6p1,aarch64,4.19内核) – lvbibir's blog
一、下载openssh源码
https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.2p1.tar.gz
二、RPM包编译环境
yum install openssl-devel krb5-devel pam-devel rpm-build -y
mkdir /root/rpmbuild/{RPMS,SOURCES,SPECS}
解压缩文件并且存放于具体路径
将 openssh-9.2p1 存放于/root/rpmbuild/SOURCES
将 openssh.spec存放于 /root/rpmbuild/SPECS
注意原始文件路径为: /openssh-9.2p1/contrib/redhat
与之前的文档一样, 需要修改: 注意需要修改openssh.spec
如下三个配置:
%global no_x11_askpass 1
%global no_gnome_askpass 1
#BuildRequires: openssl-devel < 1.1 #注意将 最后一个配置文件注释掉.
三、生成与安装rpm
cd /root/rpmbuild/SPECS
rpmbuild -bb openssh.spec
cd /root/rpmbuild/RPMS/x86_64/
四、备份和升级
cp /etc/pam.d/sshd /etc/pam.d/sshd_bak
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_bak
rpm -Uvh ./*.rpm
cp -r /etc/pam.d/sshd_bak /etc/pam.d/
cp /etc/ssh/sshd_config_bak /etc/ssh/sshd_config
rm -rf /etc/ssh/ssh*key
systemctl daemon-reload
systemctl restart sshd
版本验证
ssh -V
启动文件报错
systemctl restart sshd
Warning: The unit file, source configuration file or drop-ins of sshd.service changed on disk. Run
'systemctl daemon-reload' to reload units.
自定义一份启动文件
vi /usr/lib/systemd/system/sshd.service
[UNIT]
Description=OpenSSH server daemon
After=network.target sshd-keygen.target
Wants=sshd-keygen.target
[Service]
Type=forking
ExecStart=/etc/rc.d/init.d/sshd start
ExecReload=/etc/rc.d/init.d/sshd restart
ExecStop=/etc/rc.d/init.d/sshd stop
PrivateTmp=True
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl restart sshd