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 a desktop and laptop at home, both running the same flavour of Debian Testing. How can I configure apt on the laptop so that it first tries to download the packages from the desktop before going to the Internet?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

There are several ways. One of the easiest is to install squid. Squid is simply a web/FTP cache, but that means it will cache your Debian downloads--as well as any web sites. So it has an added bonus!

One drawback of using squid (or any caching proxy server) is that your sources.list must all point to the same mirror, or the cache hits won't help.

Another option is apt-proxy. I haven't used it, but my understanding is that it works much like squid, but is specifically tailored for use with apt repositories--so it may not require that you use the same mirror for all machines, and may have other apt-specific optimizations.

A third option is to set up a partial mirror that you keep in sync with an upstream mirror. This probably isn't really what you want, though, as it's much more involved to configure, and uses a lot more bandwidth.

And a final, poor-man's option, would be to keep /var/cache/apt/archives in sync between the two systems, possibly using rsync. You could simply run this command before doing any apt installs:

rsync -vc username@otherhost:/var/cache/apt/archives/* /var/cache/apt/archives

This won't cache the Packages files at all (the other methods I mentioned would), but whenever the system is about to download a package, if that package already exists in that dir, it won't do the download. So you'd get most of the benefit of a proper caching server, without the setup overhead.

I generally only use this last method for one-off instances, like on a fresh install.

share|improve this answer
    
Do I run this rsync command on the desktop (the one with the cache) or on the laptop (the one that is going to be upgraded)? –  Grzenio Jun 29 '11 at 6:54
    
As written, that rsync command copies from the remote host to the local host. But rsync can work either way. –  Flimzy Jun 29 '11 at 7:00
add comment

I think you should try out apt-cacher. If you click that link, you'll be taken to a guide/tutorial that explains, in fairly nice detail, how to do this.

share|improve this answer
add comment

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.