I’ve done this using apt-mirror already, but it turns out, apt-mirror has a few caveats:
- it’s unmaintained
- it requires debootstrap + chroot
On top of that, I’ve been having issues enabling multi-arch for my repo. So I tried out apt-cacher-ng too, but it turned out to not play too well with reverse proxies. Then I tried debmirror, and guess what? It produced the exact same problem as apt-mirror. At this point it became clear the problem lies within the client, and my current workaround is as simple as:
sudo sed -i 's/NATIVE_ARCHITECTURE/ARCHITECTURE/' /etc/apt/apt.conf.d/50appstream
I have no idea if this will break anything, anywhere, ever. This is what I’m using now, and it seems to be working fine so far.
Anyway, using debmirror on CentOS is really simple. Just install it:
yum install epel-release yum install debmirror
Then you also gotta make sure you trust the mirror key. If you’re using archive.ubuntu.com, it should be:
gpg --no-default-keyring --keyring ~/.gnupg/trustedkeys.gpg --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
Now you can decide if you use
/etc/debmirror.conf which won’t allow for a multi-arch mirror, since ports reside on a different URL. You can also choose to provide all parameters on the command line, which results in a lot of redundancy, since the vast majority of parameters will be the same.
So I decided to write up my own wrapper script:
The repo has example config files, so it should be pretty straightforward to get going. Cheers 🙂