2012-05-02

apt-catcher-ng No client changes needed.

If you're familiar with windows updates and the need to have a WSUS server on your network to locally cache the torrent of Windows updates and now have a bunch of Ubuntu boxes on your network, you'll want to read on. 


apt-catcher-ng, apache2, a small php script, and some dns changes are the solution you need to cache these updates locally.   Best of all you'll never need to reconfigure any of the Ubuntu boxes on your network.

apt-catcher-ng stores the updates when requested from a http url in the local cache, it does this using a mangled url.

Normal apt url:   http://us.archive.ubuntu.org/ubuntu/pool/main/s/blah blah
Normal apt-catcher url:  http://<apt-catcher-ng hostname>:3142/us.archive.ubuntu.org/ubuntu....

To get the clients to update you now need to modify their sources, or insert a line to proxy on all of them.  Major pain.

If you can update your DNS to re-direct all the us.archive.ubuntu.org to the apt-catcher server, they'll all get 404's as the apt-catcher server is running on the wrong port 3142, and the request arrives on port 80.

So, why not use a php script to do a redirct to let the client go to the right URL and transform the url into the apt-catcher-ng mangled url at the same time.

Your configuration will probably be different, but here are a few notes:


  • apt-catcher-server needs a different dns server in resolv.conf, otherwise it will resolve us.archive.ubuntu.org to itself, and no updates.
  • Either use mod_rewrite, or make the 404 page your index.php page that does the rewrite, otherwise you'll miss URL requests.
  • Expect the cache to grow.  Perhaps put a second disk into that VM.
Two days later things are working great.