Quick and easy yum repo mirroring with containers!

This is another one of those reminders to myself that reposync on Oracle Linux 8 has the ability to sync all packages and metadata and it’s installed by default in the oraclelinux:8 container image. Combined those two pieces of knowledge and you get a quick and easy yum repo mirroring solution.

The updated version of reposync that ships in all EL8-based distributions has some new options that make it possible to sync a multiple repos without needing to manually configure them beforehand, all in a single command.

Here’s a sample command:

1
2
3
4
5
6
reposync --repo=ol7_UEKR4 \
  --repofrompath=ol7_UEKR4,https://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/x86_64 \
  --delete \
  --download-metadata \
  --download-path /repos \
  --remote-time

Let’s look at those parameters in more detail, shall we?

Combine all that with the container engine of your choice and you can create a single (albeit quite long) command to sync all the content you want. Here’s an example that uses a Docker container to download the base repos required for both Oracle Linux 7 and 8 to the /repos folder on the host:

1
2
3
4
5
6
7
8
9
docker run --rm -it -v /repos:/repos oraclelinux:8 \
  reposync  --delete --download-metadata --remote-time \
  --download-path=/repos \
  --repo=ol7_latest --repofrompath=ol7_latest,https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/ \
  --repo=ol7_optional_latest --repofrompath=ol7_optional_latest,https://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/x86_64/ \
  --repo=ol7_UEKR6 --repofrompath=ol7_UEKR6,https://yum.oracle.com/repo/OracleLinux/OL7/UEKR6/x86_64/ \
  --repo=ol8_baseos_latest --repofrompath=ol8_baseos_latest,https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/ \
  --repo=ol8_appstream --repofrompath=ol8_appstream,https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/ \
  --repo=ol8_UEKR6 --repofrompath=ol8_UEKR6,https://yum.oracle.com/repo/OracleLinux/OL8/UEKR6/x86_64/

At some point I’ll probably create a container image that automates this completely, but this will do for now.

← Back to the archive