centos7 build openssh8.7 rpm


1.安装依赖包

yum -y install rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel xmkmf libXt-devel gtk2-devel make
2.下载软件包openssh-8.7p1.tar.gz和x11-ssh-askpass-1.2.4.1.tar.gz
wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.7p1.tar.gz
wget 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
3.创建相关目录
mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

4.解压openssh-8.7p1.tar.gz修改openssh.spec

tar zxvf openssh-8.7p1.tar.gz

vim openssh-8.7p1/contrib/redhat/openssh.spec

注释下面这一行

#BuildRequires: openssl-devel < 1.1

修改后把此文件拷贝到/root/rpmbuild/SPECS

cp openssh-8.7p1/contrib/redhat/openssh.spec /root/rpmbuild/SPECS/

拷贝openssh-8.7p1.tar.gz和x11-ssh-askpass-1.2.4.1.tar.gz到/root/rpmbuild/SOURCES

cp openssh-8.7p1.tar.gz /root/rpmbuild/SOURCES/

cp x11-ssh-askpass-1.2.4.1.tar.gz /root/rpmbuild/SOURCES/

5.构建rpm包

cd /root/rpmbuild/SPECS/

1
 
rpmbuild -ba openssh.spec
构建完成之后rpm包在/root/rpmbuild/RPMS/x86_64
openssh-8.7p1-1.el7.x86_64.rpm
openssh-clients-8.7p1-1.el7.x86_64.rpm
openssh-askpass-8.7p1-1.el7.x86_64.rpm
openssh-debuginfo-8.7p1-1.el7.x86_64.rpm
openssh-askpass-gnome-8.7p1-1.el7.x86_64.rpm
openssh-server-8.7p1-1.el7.x86_64.rpm
安装rpm包
yum localinstall ./*.rpm
重启sshd服务
systemctl restart sshd && systemctl enable sshd

Whatever is worth doing is worth doing well.