[CentOS] Own CentOS MirrorList

Mon Jun 10 17:05:02 UTC 2019
Mark Milhollan <mlm at pixelgate.net>

On Mon, 10 Jun 2019, Daniel Watson wrote:

>I am interested in setting up my OWN mirrorlist like 
>where it pulls a few local mirrors, but mine would be statically set 
>with 3 or 4 different location URL's

There isn't much magic to the response, it is a list of sources for the 
specified repository (sample below).  You might look at the MirrorBrain 
project, though likely it is overkill and you can just use trivial 
server-side code (e.g., PHP or Node.js) for the index that inspects the 
provided parameters (release, arch, etc.) and responds with the related 
list of statically defined mirror URLs (perhaps randomized) or a subset 
if large.  The CentOS project provides a subset of their 600+ mirrors, 
typically 10, and sorted in a preference and geographic order as closely 
matching the origin of the request as makes sense (sample below from 
west coast of the us).  You might do similar even if your list is short, 
when the east coast makes the request you send the list with the URLs 
for east coast servers first but when the west coast requests the list 
has west coast servers first.  If you want the name 
mirrorlist.centos.org to lead to your mirrorlist provider then you need 
to arrange for the name to resolve to your servers -- I suggest at least 
two but perhaps more if you have a good deal of diversity -- or perhaps 
look into using Spacewalk.

   $ curl 'http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock'

Which is pretty clear, but just in case I'll diagram the dynamic 
portions using the final result (monospace font):

     arch ---------------------------------------v
     repo ------------------------------------v
     release ------------------------v