[CentOS] Local mirroring of the CentOS repos
Ross S. W. Walker
rwalker at medallion.com
Wed Oct 10 18:47:07 UTC 2007
Kai Schaetzl wrote:
> I figured I try if I can mirror the base and updates repos locally.
> There's no tutorial for that, only one about creating your
> own repo of
> packages which is not the same. So, I just mirrored all the
> stuff with
> wget and changed the baseurl in the repo files and hoped
> that's enough.
> Works. So easy you don't need a tutorial.
> *But* I then realized that the updates directory contains
> *all* updates,
> not just the latest. Which means if I don't regularly check I
> may get old
> versions mirrored I don't want. It also means that I get a
> lot of unwanted
> files at the time I start to mirror. And I cannot delete old files as
> these would again be mirrored in.
> An obvious solution would be to check each day and tell wget
> (or whatever
> software I use) to ignore files older than 24 hours. Still,
> this means the
> initial download has to get them all and I have to delete all
> unwanted old
> files manually.
> Is there a better solution?
Yes a lot of past versions are kept in the repo, but if you filter
those out then it wouldn't be a "mirror" then?
Be careful with the "repomd.xml" file, delete it before starting to
mirror to make sure it doesn't get out-of-sync, because, at least on
my end, I find that wget via http doesn't compare time stamps just
sizes/names and the sha1 checksums are always the same length.
Here's a little script:
mkdir -p /Software/CentOS/$VERSION/updates/i386 >/dev/null 2>&1
mkdir -p /Software/CentOS/$VERSION/updates/x86_64 >/dev/null 2>&1
rm -f /Software/CentOS/$VERSION/updates/i386/repodata/repomd.xml >/dev/null 2>&1
rm -f /Software/CentOS/$VERSION/updates/x86_64/repodata/repomd.xml >/dev/null 2>&1
wget -nH --cache=off --cut-dirs=4 -m -c -R gif,png,^index.html* -I ^/centos/$VERSION/updates/i386/ -P /Software/CentOS/$VERSION/updates/i386 http://mirror.centos.org/centos/$VERSION/updates/i386/
wget -nH --cache=off --cut-dirs=4 -m -c -R gif,png,^index.html* -I ^/centos/$VERSION/updates/x86_64/ -P /Software/CentOS/$VERSION/updates/x86_64 http://mirror.centos.org/centos/$VERSION/updates/x86_64/
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.
More information about the CentOS