Creating Local Mirror for Repository (APT/RPM)

I am looking to create a local mirror for the APT (Debian) and RPM (Fedora) Repositories since I have quite a few Caddy Instances and it would speed up the apt update and dnf update Commands significantly.

Unfortunately, there doesn’t seem to be an easy Solution out of this :sad_but_relieved_face: .

APT

It seems I could finally manage it with debmirror:

debmirror --debug --rsync-extra=none --host=dl.cloudsmith.io --root=public/caddy/stable/deb/debian --dist=any-version --section=main --arch=amd64,aarch64 --nosource --method=http --cleanup --keyring=/usr/share/keyrings/caddy-stable-archive-keyring.gpg --omit-suite-symlinks /data/debmirror/caddy

RPM

I can manage it with dnf reposync, but I need to define a Repository in /etc/yum.repos.d for each Version & Architecture that I want to download :disappointed_face::

dnf reposync --releasever=${FEDORA_RELEASE} --arch=${FEDORA_ARCH} --norepopath --repoid=copr:copr.fedorainfracloud.org:group_caddy:caddy --download-metadata --delete -p /data/dnf-reposync/caddy/fedora-${FEDORA_RELEASE}-${FEDORA_ARCH}/

Whereas with wget first of all it creates a host of sub-sub-sub-sub-directories OR I use --cut-dirs=3 but then I cannot filter using --accept-regex. Furthermore lots of Things get duplicated and a lot of <folder>.1 get created (the <folder>.1 is actually a File in most Cases, whereas <folder> is indeed a Folder).

cd /data/dnf-reposync/caddy/rpm && wget --mirror -nH --accept-regex "results\/@caddy\/caddy\/.*\/" https://download.copr.fedorainfracloud.org/results/@caddy/caddy/

...

[mirror@dnf-reposync rpm]$ ls -la /data/dnf-reposync/caddy/rpm/results/@caddy/caddy/fedora-43-x86_64
total 72
drwxr-xr-x  5 mirror mirror    8 Feb 27 08:12 .
drwxr-xr-x 22 mirror mirror   22 Feb 27 08:12 ..
drwxr-xr-x  2 mirror mirror   16 Feb 27 08:12 09459771-caddy
-rw-r--r--  1 mirror mirror 8704 Feb 27 08:12 09459771-caddy.1
drwxr-xr-x  2 mirror mirror   17 Feb 27 08:12 10158389-caddy
-rw-r--r--  1 mirror mirror 8940 Feb 27 08:12 10158389-caddy.1
drwxr-xr-x  2 mirror mirror    6 Feb 27 08:12 repodata
-rw-r--r--  1 mirror mirror 7344 Feb 27 08:12 repodata.1

I couldn’t find any official Information on how to create such mirroring for RPM Packages.

Any help would be appreciated :+1: .