3

On a current (2018-06) Debian sid, installing .deb packages via apt-get or aptitude or synaptic caches the downloaded packages in /var/cache/apt/archives:

# rm -f /var/cache/apt/archives/nano_*
# aptitude install nano
  [...]
# aptitude purge nano
  [...]
# ls /var/cache/apt/archives/nano_*

/var/cache/apt/archives/nano_2.9.7-1_amd64.deb

Using the frontend apt does not cache the downloaded files anymore:

# rm -f /var/cache/apt/archives/nano_*
# apt install nano
  [...]
# ls /var/cache/apt/archives/nano_*
ls: cannot access '/var/cache/apt/archives/nano_*':
      No such file or directory

So switching between two mutually exclusive sets of packages re-downloads everything. How can I change the settings of apt to keep the downloaded files?

3

Create a /etc/apt/apt.conf.d/01keep-debs file with the following content:

Binary::apt::APT::Keep-Downloaded-Packages "true";  

Your *.deb should be kept in /var/cache/apt/archives/* directory.

Or use it as option to keep the debs files for some selected packages.

 apt -o APT::Keep-Downloaded-Packages="true" install some_package.
  • 1
    Thank you. And FTR, this is option is not documented in the man-page for apt.conf, apt-config or apt_preferences. – finite graygreen Jun 3 '18 at 12:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.