下载源码包
[root@localhost ~]# ssh -V
[root@localhost ~]# wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.1p1.tar.gz
[root@localhost ~]# wget http://ftp.riken.jp/Linux/momonga/6/Everything/SOURCES/x11-ssh-askpass-1.2.4.1.tar.gz
下载相关依赖包
[root@localhost ~]# yum install rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel unzip -y
创建所需目录
[root@localhost ~]# mkdir -p /root/rpmbuild/{SOURCES,SPECS}
把所需的包拷贝到该目录下面
[root@localhost ~]# cp /openssh-8.1p1.tar.gz x11-ssh-askpass-1.2.4.1.tar.gz /root/rpmbuild/SOURCES/
[root@localhost ~]# cd /root/rpmbuild/SOURCES/
[root@localhost ~]# tar -xzvf openssh-8.1p1.tar.gz
[root@localhost ~]# cp openssh-8.1p1/contrib/redhat/openssh.spec /root/rpmbuild/SPECS
修改配置文件
[root@localhost ~]# sed -i -e "s/%define no_x11_askpass 0/%define no_x11_askpass 1/g" openssh.spec
[root@localhost ~]# sed -i -e "s/%define no_gnome_askpass 0/%define no_gnome_askpass 1/g" openssh.spec
构建包
[root@localhost ~]# vim openssh.spec
注释掉 BuildRequires: openssl-devel < 1.1 因为目前安装的版本都低于1.1
[root@localhost ~]# rpmbuild -ba openssh.spec
安装包在下边目录
[root@localhost ~]# cd rpmbuild/RPMS/x86_64/
[root@localhost x86_64]# ls
openssh-8.1p1-1.el7.centos.x86_64.rpm openssh-clients-8.1p1-1.el7.centos.x86_64.rpm openssh-debuginfo-8.1p1-1.el7.centos.x86_64.rpm openssh-server-8.1p1-1.el7.centos.x86_64.rpm
以上,升级请看下篇