Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have several Linux virtual machines running on my home PC. One of the quirks of Linux is that every time you run a package manager, it wants to "refresh" the configured software repositories - which basically means it wants to download a file from the Internet. If I revert to an earlier snapshot of the VM, then next time I run the package manager it will re-download the exact same data again [since it no longer exists in the VM].

It seems a shame to waste bandwidth endlessly downloading the same data over and over again, so I was wondering if there's some way I can set up some kind of HTTP proxy server that caches downloaded files. I have no idea how you would do such a thing though. In particular, it needs to be set up so that the VMs don't need to "know" that the cache is there; it needs to be transparent. But I don't know how to do that.

Any suggestions on what software I'd need to use? It would be nice if I could run it under the Windows host OS, but running a small VM with a Linux guest is also possible...

share|improve this question

1 Answer 1

This slideshow covers several solutions for a package-caching proxy for debian-based linux distributions:

Approx

  • Runs as a proxy: You tell it what mirrors to use, and then configure the clients to use it as the sole mirror.

    Installing on the package host: sudo apt-get install apport

  • Configure Approx to use your favorite backend mirrors in /etc/approx/approx.conf:

    debian   http://ftp.au.debian.org
    non-US   http://ftp.au.debian.org/non-US
    security http://security.debian.org/security
    
  • Configure client to use the Approx server:

    deb http://localcache:9999/debian stable main contrib
    deb http://localcache:9999/security stable main
    

Apt-Proxy

  • Similar to Approx

    Install with sudo apt-get install apt-proxy

  • Configure favorite mirrors in /etc/apt-proxy/apt-proxy-v2.conf:

    [debian]
    backends =
        http://ftp.au.debian.org
        http://ftp.us.debian.org
    
  • Configure clients like with Approx:

    deb http://localcache:9999/debian stable main contrib
    deb http://localcache:9999/security stable main
    

They're designed to be run on linux, but you might be able to port them over to Windows with minimal trouble. I'd like to hope that Python is platform independent, but I've found that programmers often make assumptions.

share|improve this answer
    
The "configure the client" bit was the part I was hoping to avoid. Also, I'm using OpenSUSE, which is RPM-based, not Deb. Which is why I was looking at general web caching, rather than repo-specific caching... –  MathematicalOrchid Nov 3 '12 at 9:49
    
@MathematicalOrchid Squid is one of the usual go-to transparent HTTP proxies, but it's not optimized for large files, and a generic caching algorithm will be extremely inefficient for rpms or debs. You should add into your question that you're looking specifically for a way to cache RPM packages. –  Darth Android Nov 4 '12 at 16:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.