Debian – Increasing Size Limit for /var/cache/apt/archives

aptcachedebian

I have 2 systems running Debian at home and I am trying to minimize the bandwidth use while upgrading the packages. How can I increase the size limit of the cache, so that I could just copy the packages over LAN? (currently they get removed too quickly)

Best Answer

The size limit is controlled by the apt option APT::Periodic::MaxSize. You can display your current value using the following command:

apt-config dump | grep Periodic

To set the size, edit or create the file /etc/apt/apt.conf.d/99local-archive and any of the following lines:

APT::Periodic::MaxSize "<size_in_MiB>";
APT::Periodic::MaxAge "<days>";
APT::Periodic::MinAge "<days>";

See /etc/cron.daily/apt for comments on available options, and the transition from APT::Archives::*. (Ubuntu 14.04 ships /etc/apt/apt.conf.d/20archive which sets APT::Archives::MaxSize. When they transition to APT::Periodic in that file, it will matter that you put your local changes in a file with a higher number.)

This sets the maximum size of the cache in MiB. If the cache is bigger, cached package files are deleted until the size requirement is met (the biggest packages will be deleted first).

Make sure to do this on all machines that mount the directory.

Related Question