Gentoo Local-Mirror Operation

From Research
Jump to navigation Jump to search

Running our local-mirror of Gentoo (and other distributions) is a two-part process:

  • we pull the updated packages and information from a source on the 'Net (typically the distribution's canonical source). This gives us a local copy to work from.
  • our machines then contact this local-re-server, and synchronize


This first step is performed on musashi, using these (sample) /etc/crontab entries:

45 *  * * *    test -x /usr/local/bin/mirror-scripts/gentoo.portage && /usr/local/bin/mirror-scripts/gentoo.portage
25 8,20  * * * test -x /usr/local/bin/mirror-scripts/gentoo.distfiles && /usr/local/bin/mirror-scripts/gentoo.distfiles
#3 1  * * *     test -x /usr/local/bin/cvsup-freebsd && /usr/local/bin/cvsup-freebsd >/dev/null
3 3  * * *     test -x /usr/local/bin/apt-mirror && /usr/local/bin/apt-mirror >/dev/null
5 2 * * *      test -x /usr/local/bin/mirror-scripts/gentoo.release && /usr/local/bin/mirror-scripts/gentoo.release
5 3 * * *      test -x /usr/local/bin/mirror-scripts/suse.all && /usr/local/bin/mirror-scripts/suse.all
5 4 * * *      test -x /usr/local/bin/mirror-scripts/gentoo.experimental && /usr/local/bin/mirror-scripts/gentoo.experimental
5 19 * * *     test -x /usr/local/bin/mirror-scripts/gentoo.snapshot && /usr/local/bin/mirror-scripts/gentoo.snapshot

Musashi stores the package-info on one of our RAID arrays.


For part two, nelson will NFS-mount that same RAID array with the now-updated packages, and re-serve it to the client-machines. Nelson runs rsyncd to listen for incoming (rsync) connection requests. Typically, these incoming requests are triggered by the existence of an update-script file in /etc/cron.daily/. For a Gentoo machine, this file is emergesync and looks like:

hostname ~ # cat /etc/cron.daily/emergesync
#!/bin/bash
emerge -q --nospinner --sync > /dev/null 2>&1

Another possibility, rather than a file in /etc/cron.daily, is an entry directly in /etc/crontab, like this (desktop client shown, which benefits from prelinking):

# Every morning at 1:18am (randomly chosen!) I sync with a gentoo mirror
18 1  * * *      root   /usr/bin/emerge --sync > /dev/null 2>&1 ; prelink -amvfR > /dev/null 2>&1