[CentOS] Yum site cache

Max Hetrick btmanmeh at verizon.net
Thu May 17 18:37:08 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lorenzo wrote:
> since I'm installing several copies of CentOS I was thinking of using
> some system to save bandwidth.
> 
> I started looking at mrepo, but I noticed that, if I let him sync with
> updates and rpmforge repos, I'll end with a _lot_ of unneeded files.
> Also I have to modify the various yum repos configuration files for it
> to work.

I'm not sure if this answers what you want or not, but I just use rsync
and point it to a lower level mirror as per the CentOS folks wishes.

Put it in a bash script, enter it into cron, and then it syncs every
night with a mirror of choice. There's nothing to worry about
configuring, except an exclude file.

For example:

/usr/bin/rsync -v -r -t -p --delete -l \
- --exclude-from=/usr/local/etc/centos.exclude \
rsync://one.of.the.mirrors/centos \
/srv/centos/updates 2>&1 >> /srv/centos/logs/rsync.log

My exclude file then skips all x86_64, SRPMS, ia64, isos, ppc, dvds,
etc. and just pulls the rpms and whatever else I only need. Whatever you
want to skip you can just put in here. Of course, this gets just the
base CentOS stuff. You can even skip by release if you wanted to only
get 4.4 stuff.

Then, I have a similar rsync going then to pull things from rpmforge
that I want, because I don't pull the entire repo. I only pull, again,
what I need to save some bandwidth.

> 
> What I would like to achieve is just download the same file only once:

I don't know exactly what you mean here, but the initial rsync will be
large and consume a lot of time, but then after that rsync only grabs
the files that have changed. So only the rpms that are new and changed
will be downloaded in subsequent syncs.

I hope this helps you a little. This is how I create a local yum mirror
without the hassle of configuring a lot of things. If I recall, the
CentOS folks just don't want you pulling from say their main mirror,
mirror.centos.org, but instead pick a public mirror.

Hope this helps you. Let me know if you want to see the exclude file.

Regards,
Max
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD4DBQFGTKDUHoeeepPau2ERAnW0AJY5mdXd07YhCOB5JKsS3M1JL2g/AJ9DM/cM
HcEUwChVt9QNb4QZvdTsCA==
=09W8
-----END PGP SIGNATURE-----



More information about the CentOS mailing list