Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Let's say I have at home 3 computers running Debian testing. They mostly have the same configuration and most of the packages installed are identical.

Every time I update/upgrade the Debian packages, they are downloaded from the Internet.

Is there a way to pre-fetch the Debian packages from the Internet and have a local, up-to-date Debian repository containing only the packages I have installed that have an available update?

So, typically, if I have vim installed and an update is released, my server will go and fetch the .deb locally and I could upgrade all my machines from the LAN. If I want to install emacs, then the local repository will not have it and it will be downloaded from the Internet.

One could call it a local apt caching system, like Squid does http caching.

Thanks!

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

It seems that you are look for apt-cacher. To install it, just type:

$ sudo apt-get install apt-cacher

You can then configure apt-get to use it as proxy by creating a file /etc/apt/apt.conf.d/01proxy with content:

Acquire::http::Proxy "http://cacher_ip:3142/";

To be honest, I am using this configuration on ubuntu, but it should be similar on debian. This way all package downloads will be requested from apt-cacher on server "cacher_ip". If it exists, it will be fetched locally. Otherwise, it will be downloaded via the cacher.

share|improve this answer
1  
apt-cacher-ng is a good alternative, as well. –  Shane Madden Mar 20 '12 at 15:40
    
Great answer, thanks! The apt-cacher keyword helped me to find other alternatives, such as approx and apt-cacher-NG. –  CJlano Mar 20 '12 at 15:44
    
@ShaneMadden: You are right. Actually, I am using apt-cacher-ng! –  Khaled Mar 20 '12 at 15:54
    
I have a strong preference for approx, mostly because the etch version of apt-cacher was kinda buggy for me. –  Zoredache Mar 20 '12 at 17:07
    
etch is an old old old debian version. Things surely have changed :) –  hayalci Mar 21 '12 at 13:49
show 1 more comment

The squid proxy actually does quite a good job "out of the box" caching apt-get downloads as well as a lot more besides that. With a few tweaks it will do an even better job.

See: http://itkia.com/using-squid-to-cache-apt-updates-for-debian-and-ubuntu/

share|improve this answer
add comment

Apt-cacher-ng cannot know exactly what's available as update for each user because the client's can uninstall the packages without telling the server (obviously) or sometimes the packages are renamed or splited up into multiple packages. There are just too many factors. If you can ignore most of them and want to pre-cache every package selecting them by names (of previously download packages), have a look at https://www.unix-ag.uni-kl.de/~bloch/acng/html/howtos.html#mirroring

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.