0

I want to make a CentOS mirror with different versions of CentOS? How do I do that with reposync. I can't use rsync.

Philippe
  • 411
  • 4
  • 15
  • I can't point to anything official yet, but since ["reposync uses the yum libraries for retrieving information and packages ... yum configuration will be used"](https://linux.die.net/man/1/reposync), it would seem ... tricky ... to me to have repos on your system for multiple versions of the OS. – Jeff Schaller Mar 25 '20 at 15:40
  • I considered changing `releasever`. In some config file and changing it back before using yum again. But there doesn't seem to be any way to change it. – Philippe Mar 25 '20 at 16:24

2 Answers2

0

Copy the Yum configuration files from a machine running the CentOS distribution you want to mirror, then change $releasever to hardcode the version you want. Then you can use the -c option to reposync to tell it to use your copied configuration file instead of the system one.

For example, to mirror the latest CentOS 7 version on a CentOS 8 machine, copy /etc/yum.repos.d/CentOS-Base.repo and change $releasever in that file to 7. Then you can run:

reposync -c CentOS-Base.repo

Adding any additional desired options (for example, --repoid if you don't want to sync all the enabled repositories in that file). Similarly, you can copy and make similar changes to any additional repositories you want, such as epel.repo.

0

Looks like there is an easy way now with dnf --releasever=...

So on Rocky8 you can create Rocky9 repo easily: Download key, import key, create local repo:

curl -LO 'https://dl.rockylinux.org/pub/rocky/RPM-GPG-KEY-Rocky-9'
rpm --import RPM-GPG-KEY-Rocky-9
dnf --releasever=9 reposync -g --delete -p /storage/repos/9/ --repoid=extras --download-metadata
AdminBee
  • 21,637
  • 21
  • 47
  • 71
Nicco
  • 45
  • 5