apt-cacher and apt-cacher-ng both act as a proxy between apt-get
or aptitude
and the Debian repositories. It stores the packages upon first request and loads them from cache on further ones. If you have 2 or more Ubuntu PCs in your network, you can save a massive amount of bandwidth with it.
Installation
- Install the package apt-cacher or apt-cacher-ng
- Make sure it is running (sometimes you might have to edit a file
/etc/default/apt-cacher
or/etc/default/apt-cacher-ng
to enable it) - Now do the following on ALL PCs in your network – including the one with
apt-cacher(-ng)
installed:- Create a file
/etc/apt/apt.conf.d/01proxy
with the following contents: (replace the IP by the IP of the PC withapt-cacher(-ng)
installed)Acquire::http::Proxy "http://192.168.0.1:3142";
- Create a file
/etc/apt/apt.conf.d/99clean
with the following contents: (this will keep the local apt-cache clean)DPkg::Post-Invoke {"/usr/bin/find /var/cache/apt/archives/ -type f -mtime 2 -name *.deb -exec /bin/rm -f {} \; || true";};
- Create a file
That was it. All packages will be cached on the apt-cacher(-ng)
-PC and the local caches will be kept clean.