I tried apt-cacher, which is supposed to work, but it didn't for me.
Then I tried apt-cacher-ng.
(At my office we connect to the internet through a proxy server which requires username/password authentication,
so obviously I needed to configure apt-cacher-ng to connect
through our normal web proxy to be able to access the internet)
But it gave met the following error when I tried to use it:
407 Proxy Authentication Required
after struggling for some time, I figured out on this Russian site how to fix my problem:
http://linuxforum.ru/index.php?s=c9cb81224e4e338dc7ba84b6857dca5f&showtopic=69037&st=0&p=661582&#entry661582
It turns out the sample config file (/etc/apt-cacher-ng/acng.conf) is making you configure the proxy wrongly.
So in stead of configuring like:
proxy: http://user:pass@srv:port
do it like:
proxy: user:pass@srv:port
Now that I could configure my apt-cacher-ng to connect through and authenticate to our internet proxy, I'm able to switch to using it by merely editing /etc/apt/apt.conf:
Acquire::http { Proxy "http://myaptcacherng:3142"; };
//Acquire::http { Proxy "http://networkproxy:3142"; };
(lines starting with // are considered comments)
To Import .deb files from the local apt cache:
# let apt-cacher-ng use the .deb files that are already in /var/cache/apt/archives/
sudo mkdir -p /var/cache/apt-cacher-ng/_import
sudo chown apt-cacher-ng /var/cache/apt-cacher-ng/_import
sudo cp -al /var/cache/apt/archives/* /var/cache/apt-cacher-ng/_import/
# browse to
(from http://ubuntuforums.org/archive/index.php/t-981085.html )