以openssh9.3p2为例
下载openssh-9.3p2.tar.gz和x11-ssh-askpass-1.2.4.1.tar.gz
先安装rpm-build软件
# yum install rpm-build
生成rpm包
# mkdir /root/rpmbuild
# cd /root/rpmbuild
# mkdir BUILD BUILDROOT RPMS SOURCES SPECS SRMPS SRPMS
# cd SOURCES
# cp -rv openssh-9.3p2.tar.gz .
# cp -rv x11-ssh-askpass-1.2.4.1.tar.gz .
# tar zxfv openssh-9.3p2.tar.gz
# cp -rv openssh-9.3p2/contrib/redhat/openssh.spec ../SPECS/
# ../SPECS/
# sed -i -e "s/%global no_gnome_askpass 0/%global no_gnome_askpass 1/g" openssh.spec
# sed -i -e "s/%global no_x11_askpass 0/%global no_x11_askpass 1/g" openssh.spec
# sed -i -e "s/^BuildRequires: openssl-devel < 1.1/#BuildRequires: openssl-devel < 1.1/g" /root/rpmbuild/SPECS/openssh.spec
# rpmbuild -ba openssh.spec
如果有报错提示缺库文件,可通过yum install xxx安装解决
成功的话rpm会在/root/rpmbuild/RPMS/x86_64下面
安装
# rpm -U /root/rpmbuild/RPMS/x86_64/*.rpm