[CentOS] auto-creating a local yum cache?
Reindl Harald
h.reindl at thelounge.net
Mon Dec 12 20:54:40 UTC 2011
Am 12.12.2011 21:49, schrieb Alan McKay:
> Hey folks,
>
> I just did an update on a system that is taking the better part of a day (
> 5.3 ---> 5.7 ) mainly due to file download times.
>
> And I have 4 or 5 more systems to do.
>
> I know I can create my own repository and then point them at it - but that
> is difficult here because rsync is blocked (ggrrrrrr...)
>
> Surely there must be a way to have yum on the first box automatically cache
> everything and then have the other boxes use the cache? Maybe if not
> directly, then with squid or something like that?
>
> Anyone happen to have done this before?
i am using this script since years to have running one build/update-server
caching all packages in a local-repo and all other machines in the network
have only the via http exported cache-repo active
this machine must have all packages used in the whole network installed
this si for fedora, but CentOS should not be the big difference
1. you save bandwith / time
2. you can be sure that all machines having the same package-versions
[root at buildserver:~]$ cat /buildserver/repo-cache.sh
#!/bin/bash
basearch=`uname -i`
releasever=`rpm -q --qf "%{version}\n" fedora-release`
# Alle Subfolder unter "/var/cache/yum" durchlaufen und RPM-Pakete
# in das eigene Repo kopieren
for g in `ls -1b /var/cache/yum`
do
if [ -d /var/cache/yum/$g/packages ]
then
echo "/var/cache/yum/$g/packages/ > /repo/cache/fc$releasever/"
sudo cp --verbose /var/cache/yum/$g/packages/*.rpm /repo/cache/fc$releasever/ 2> /dev/null
fi
done
sudo createrepo -d /repo/cache/fc$releasever/
sudo chown -R builduser:builduser /repo/cache/fc$releasever/
sudo chmod -R 755 /repo/cache/fc$releasever/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20111212/090e0c77/attachment.sig>
More information about the CentOS
mailing list