openssh9.8编译rpm

环境信息

centos 7.9

环境安装

yum groupinstall -y "Development Tools"
yum install -y imake rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel git wget

下载相关软件

git clone https://github.com/boypt/openssh-rpms.git


将以下两个包下载后放在openssh-rpms/download目录中
https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
https://www.openssl.org/source/openssl-1.1.1w.tar.gz

[root@centos downloads]# pwd
/root/openssh-rpms/downloads
[root@centos downloads]# ls
openssh-9.8p1.tar.gz  openssl-1.1.1w.tar.gz  x11-ssh-askpass-1.2.4.1.tar.gz

配置修改

[root@centos ~]# cd openssh-rpms/
[root@centos openssh-rpms]# pwd

[root@centos openssh-rpms]# diff pullsrc.sh /root/openssh-rpms/pullsrc.sh
23c23
< source version.env
---
> source ./version.env



[root@centos openssh-rpms]# diff version.env /root/openssh-rpms/version.env
1c1
< OPENSSLSRC=openssl-3.0.14.tar.gz
---
> OPENSSLSRC=openssl-1.1.1w.tar.gz



[root@centos openssh-rpms]# diff compile.sh /root/openssh-rpms/compile.sh
70c70
<       source version.env
---
>       source ./version.env


[root@centos openssh-rpms]# diff el7/SPECS/openssh.spec  /root/openssh-rpms/el7/SPECS/openssh.spec
307a308
> install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT/usr/bin/ssh-copy-id
317,323d317
< # Modify ssh config file, to ensure that traditional RSA-type key authentication is available to avoid git clone failures.
< # See: https://support.genymotion.com/hc/en-us/articles/9500420360093-I-get-the-error-no-matching-host-key-type-found-Their-offer-ssh-rsa-when-trying-to-connect-with-SSH
< cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/ssh_config
< Host *
<     HostKeyAlgorithms = +ssh-rsa
<     PubkeyAcceptedAlgorithms = +ssh-rsa
< EOF
396d389
<
397a391
> %attr(0755,root,root) %{_bindir}/ssh-copy-id

进行编译

[root@centos openssh-rpms]# ./compile.sh el7
....
Wrote: /root/openssh-rpms/el7/SRPMS/openssh-9.8p1-1.el7.src.rpm
Wrote: /root/openssh-rpms/el7/RPMS/x86_64/openssh-9.8p1-1.el7.x86_64.rpm
Wrote: /root/openssh-rpms/el7/RPMS/x86_64/openssh-clients-9.8p1-1.el7.x86_64.rpm
Wrote: /root/openssh-rpms/el7/RPMS/x86_64/openssh-server-9.8p1-1.el7.x86_64.rpm
Wrote: /root/openssh-rpms/el7/RPMS/x86_64/openssh-debuginfo-9.8p1-1.el7.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.GCQHw3
+ umask 022
+ cd /root/openssh-rpms/el7/BUILD
+ cd openssh-9.8p1
+ rm -rf /root/openssh-rpms/el7/BUILDROOT/openssh-9.8p1-1.el7.x86_64
+ exit 0
~/openssh-rpms
[root@centos openssh-rpms]# cd /root/openssh-rpms/el7/RPMS/x86_64/

编译完成  进行安装
[root@centos x86_64]# ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
[root@centos x86_64]# rpm -qa |grep openssh
openssh-7.4p1-23.el7_9.x86_64
openssh-server-7.4p1-23.el7_9.x86_64
openssh-clients-7.4p1-23.el7_9.x86_64


[root@centos x86_64]# rpm -Uvh ./openssh-*
Preparing...                          ################################# [100%]
Updating / installing...
   1:openssh-9.8p1-1.el7              ################################# [ 14%]
   2:openssh-clients-9.8p1-1.el7      ################################# [ 29%]
   3:openssh-server-9.8p1-1.el7       warning: /etc/ssh/sshd_config created as /etc/ssh/sshd_config.rpmnew
################################# [ 43%]
   4:openssh-debuginfo-9.8p1-1.el7    ################################# [ 57%]
Cleaning up / removing...
   5:openssh-server-7.4p1-23.el7_9    ################################# [ 71%]
   6:openssh-clients-7.4p1-23.el7_9   ################################# [ 86%]
   7:openssh-7.4p1-23.el7_9           ################################# [100%]
[root@centos x86_64]# ssh -V
OpenSSH_9.8p1, OpenSSL 1.1.1w  11 Sep 2023
[root@centos x86_64]# rpm -qa |grep openssh
openssh-clients-9.8p1-1.el7.x86_64
openssh-9.8p1-1.el7.x86_64
openssh-server-9.8p1-1.el7.x86_64
openssh-debuginfo-9.8p1-1.el7.x86_64

[root@centos x86_64]#chmod 0600 /etc/ssh/*
[root@centos x86_64]#systemctl restart sshd


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值