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:
|
|
Let’s look at those parameters in more detail, shall we?
--repolimitsreposyncto a single repo instead of trying to sync all the repos currently enabled for the host. It’s different to the more widely known--enablerepoparameter in that it enables only the specified repo. It’s a shorthand for--disablerepo=* --enablerepo=blah. It can be specified multiple times.--repofrompathtakes a value of[repoid,path]whererepoidis what would usually be between the[]in a.repofile andpathis any valuebaseurlvalue foryumordnf, including bothhttpandfilepaths. What’s even more delightful is that it can also be specified multiple times.--deletewill delete packages and metadata that have been removed upstream. This is important in the (very rare) instances where we have to pull a released package. You don’t want that left on your mirror.--download-metadatais where the real magic happens. It downloads the contents of therepodatametadata from the host so that the output folder is both automatically and immediately available as ayumrepository locally. It also downloads all the modularity metadata fordnf. And all the errata information!--remote-timetries to set the timestamps of local files to match those on the server.
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:
|
|
At some point I’ll probably create a container image that automates this completely, but this will do for now.