Skip to content

Instantly share code, notes, and snippets.

@olegbuevich
Last active December 2, 2022 19:30
Show Gist options
  • Save olegbuevich/7ae572ef3ceb681c53c3307059aad648 to your computer and use it in GitHub Desktop.
Save olegbuevich/7ae572ef3ceb681c53c3307059aad648 to your computer and use it in GitHub Desktop.
Build openssh 8 rpms for centos 6
#!/bin/bash
set -eu
OPENSSH_VERSION="8.0p1"
sudo yum install -y epel-release
sudo yum install -y mock rpm-build
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${OPENSSH_VERSION}.tar.gz
tar zxf openssh-${OPENSSH_VERSION}.tar.gz
cp /etc/pam.d/sshd openssh-${OPENSSH_VERSION}/contrib/redhat/sshd.pam
tar cpzf openssh-${OPENSSH_VERSION}.tar.gz openssh-${OPENSSH_VERSION}
sed -i "s/sshd.pam.old/sshd.pam/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/\(^%define no_x11_askpass\).*$/\1 1/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/\(^%define no_gnome_askpass\).*$/\1 1/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/PreReq/Requires/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sed -i "s/^Source1/#Source1/g" openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
rpmbuild -bs openssh-${OPENSSH_VERSION}/contrib/redhat/openssh.spec
sudo mock -r epel-6-x86_64 --rebuild /home/vagrant/rpmbuild/SRPMS/openssh-${OPENSSH_VERSION}-1.el6.src.rpm
sudo mock -r epel-6-i386 --rebuild /home/vagrant/rpmbuild/SRPMS/openssh-${OPENSSH_VERSION}-1.el6.src.rpm
@aceslup
Copy link

aceslup commented Dec 6, 2019

How to use the latest version of openssl?thx :)

@seyko2
Copy link

seyko2 commented Aug 20, 2020

Thanks very much! You saved my life. Old ssh stopped working after upgrading to openssl-1.1.1

@lebe-dev
Copy link

Something has changed :) All CentOS and epel repos for CentOS 6 are dead :)

Before installation you have to replace:

  • CentOS-Base.repo with Vault (just google it)
  • epel.repo with any mirror (i've used princeton mirror)

Before rpmbuild command you should fix bad permissions (owner\group), my os doesn't have user with uid 1000:

chown -R user:group rpmbuild

Also you should update repos section in /etc/mock/epel-6-x86_64.cfg, just copy content of CentOS-Base.repo and epel.repo files.
Be careful about file format, it ends with triple quotes """.

@matthiashaasesourceforge

see
https://github.com/boypt/openssh-rpms
.
this solves bulding the rpm's:
openssh-9.1p1-2.el6.src.rpm
openssh-9.1p1-2.el6.x86_64.rpm
openssh-clients-9.1p1-2.el6.x86_64.rpm
openssh-debuginfo-9.1p1-2.el6.x86_64.rpm
openssh-server-9.1p1-2.el6.x86_64.rpm
.
without such a lot of issues like the very old script here on this side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment