how to save bandwidth while package upgrades
Dustin Kirkland
kirkland at ubuntu.com
Wed Nov 17 01:35:27 UTC 2010
On Tue, Nov 16, 2010 at 3:02 AM, Tapas Mishra <mightydreams at gmail.com> wrote:
> Here is a mail in /var/mail/root which I received in my server logs
> http://paste.ubuntu.com/532866/
> I see same packages downloaded many times again and again.
> The servers which are upgrading are total 5 (4 virtual machines and one host)
> so is there a way I can save bandwidth on this sort of setup.
Your question and the various responses inspired me to finally post my
solution to this problem:
* http://blog.dustinkirkland.com/2010/11/yet-another-ubuntu-archive-proxy.html
Pasted here, in part:
Here's my solution...
To install, simply:
sudo apt-get install approx
Then set the URLs you want to proxy, in /etc/approx/approx.conf:
ubuntu http://archive.ubuntu.com/ubuntu
ubuntu-security http://security.ubuntu.com/ubuntu
I configured my proxy machine to listen on port 80:
sudo dpkg-reconfigure approx
Next, I took a little shortcut on my dd-wrt router's DNSMasq options,
so that I don't have to configure to each and every one of my guests
to point to my local mirror. I want that to happen automatically and
transparently to my guests. So I set my router to authoritatively
serve my local proxy's IP address as the resolution for
archive.ubuntu.com and security.ubuntu.com. The additional DNSMasq
options for me are:
address=/archive.ubuntu.com/security.ubuntu.com/10.1.1.11
where "10.1.1.11" is my proxy's static IP address.
This ensures that all of my guests transparently use my local proxy,
without having to perform custom configuration on each.
Now on the proxy itself, I don't want archive.ubuntu.com to point to
the localhost, as that won't work very well at all! So for that one
machine, I changed its DNS to point to Google's Public DNS at 8.8.8.8.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
Alternatively, I could manually set the IP address of
archive.ubuntu.com and security.ubuntu.com in that machine's
/etc/hosts.
Moreover, if I ever need to disable the use of the caching proxy on a
single guest, I can simply and temporarily change that machine's DNS
to 8.8.8.8 as above.
I'm really finding this to be a handy way of speeding up my network
installs and package upgrades on my set of Ubuntu machines at home.
I'm not wasting nearly as much disk space or network bandwidth, and I
don't have to configure anything on each and every client or
installation.
:-Dustin
More information about the ubuntu-server
mailing list