2

I would like to setup a local repo for rhel 5 and 6. Can this be done on 1 server, or do I need one server for each major version?

We have a valid, legal subscription with RH, but we would rather not pay for RH satellite.

chris
  • 21
  • 1
  • 2

1 Answers1

1

You can build packages for EL5 on an EL6 box, but the problem is that EL6 has a newer version of RPM that writes files incompatible with the version of RPM shipped with EL5. You can work around this with some arguments to rpmbuild when building your source packages, preferably in a wrapper script. Something like this will cause rpmbuild to use the older format:

#!/bin/bash
# Assumes you have an RPM environment set up in ~/rpmbuild using rpmdev-setuptree
# Argument 1: a spec file in ~/rpmbuild/SPECS
# Build the EL6 SRPM
rpmbuild -bs $1
# Build the EL5 SRPM
rpmbuild \
  --define "_source_filedigest_algorithm 1" \
  --define "_binary_filedigest_algorithm 1" \
  --define "_binary_payload w9.gzdio" \
  --define="dist .el5" \
  --define="el5 1" \
  $1

Once the SRPMs are built, you can then run mock on the EL5 and EL6 SRPMs, respectively:

for el in 5 6; do
  for package in ~/rpmbuild/SRPMS/*.el{$el}.src.rpm; do
    for arch in x86_64 i386; do
      mock -r epel-{$el}-{$arch} $package
    done
  done
done
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • I don't think we will be doing any package building - this would just be for OS updates and what not. – chris Jan 17 '13 at 05:02
  • Oh, you just want a local mirror of the Red Hat packages? Sorry, you get to buy Satellite. – Michael Hampton Jan 17 '13 at 05:11
  • 1
    It's definitely possible to create a local yum repository to update your RHEL servers WITHOUT buying satellite.. This guy has an excellent guide: http://kenfallon.com/how-to-mirror-rhn-behind-your-firewall/ – chris Jan 18 '13 at 00:26
  • @chris That might work, but it's not supported by Red Hat, and it also could be used for piracy. So I wouldn't mention it here. – Michael Hampton Jan 18 '13 at 00:32