Sunday, 2 February 2020

Rebuilding a mirror - Fedora EPEL mirroring and Apache config

This follows on from the previous post: Fedora does things differently. EPEL is a sub-project: software packaged for CentOS/Red Hat Enterprise Linux by the Fedora Project maintainers.

Mirroring Fedora appears to be unusual if you're not a major (Tier 1) mirror.

The Fedora Wiki page at https://fedoraproject.org/wiki/Infrastructure/Mirroring
is very useful.

Public mirrors are required to have minimum bandwidth and, ideally, to include everything. Fedora is large: fedora-buffet is the whole thing under /pub to download for those who have many TB to spare. fedora-enchilada is everything under /pub/fedora (including the Fedora distribution itself), fedora-epel is EPEL alone.

Public mirrors are required to register with the Fedora Account System [FAS]: those undertaking private mirroring are requested to mirror from Tier1 mirrors or below. The script below relies on mirrors which include fedora-buffet. These are used to achieve rsync speed-ups (by accessing cached bundles of timestamps to speed up differential transfers based on the time files changed).

Since I'm not running a public mirror and not reporting back to the public mirror network stats using mirror-manager, I needed to find a Tier1 mirror that would permit me to mirror privately and my nearest is Hoch Schule Esslingen at ftp-stud.hs-esslingen.de

The suggested mirroring script is quick-fedora-mirror available from Fedora's git repositories at https://pagure.io/quick-fedora-mirror This is licensed under Creative Commons CC0.

The script is written in zsh (with features not included in bash or other shells) and Python3 so I had to do a quick apt-get install zsh. There is a quick-fedora-mirror.conf.dist file included as a template for editing. The suggestion for the completed quick-fedora-mirror.conf file is to move it to /etc

The script requires space somewhere to store a couple of files: timefile and timefile.prev which record the times that the script was last run. I found it easier to just put these into /home/mirror and I copied the quick-fedora-mirror script itself into /usr/local/bin/

One easy mistake to make: this script should be configured to write into the top level directory - so into /srv/mirrors rather than /srv/mirrors/epel or you end up with /srv/mirrors/epel/epel

Apache2 configuration

This was relatively easy - set the document root to /srv/mirrors by uncommenting the relevant lines for /srv in /etc/apache2/apache.conf and amend the /etc/apache2/000-default to show /srv/mirrors as the new DocumentRoot

This results in the six separate directories all being appropriately served under http://localhost as /centos, /debian, /debian-cd, /epel, /ubuntu and /ubuntu-releases.


No comments:

Post a Comment