local LAN mirror for CentOS
- categories: linux
- tags: centos, lan, linux, mirror, netiquette, rsync
I find myself needing to setup RedHat like environments more and more these days and after install 4, 5, and 6 using CentOS it seems like I could get more economy if I had a simple OS level mirror on my gateway box. Did a bit of searching and surprise, surprise someone has already solved that problem. There is a good example on the CentOS mirrors page1 that I used as the starting point, just made some minor tweaks for my environment and let it ride.
#!/bin/sh rsync="/usr/local/bin/rsync -avqHz --delete --delay-updates "# --bwlimit=256" mirror=msync.centos.org::CentOS ver=5.5 archlist="i386 x86_64" baselist="os updates" local=/var/www/u1/pub/CentOS for arch in $archlist do for base in $baselist do remote=$mirror/$ver/$base/$arch/ echo " Running command: $rsync $remote $local/$ver/$base/$arch/ " $rsync $remote $local/$ver/$base/$arch/ done done
Thanks to jlar310 @ CentOS forums for sharing, in his one and only post back in 2006 :)
Added this to the crontab to run weekly on my soekris gateway, and now I have a local http mirror and we all lived happily ever after, the end.