How to keep /var/cache/apt/archives/*.deb after upgrade?

On ubuntu, the .deb files in /var/cache/apt/archives after running apt upgrade is kept for around 30 days. On lubuntu, by default, these deb files are deleted upon installation of them.

Now I have a cluster of servers all running lubuntu, I want only the “head node” connected to the internet, and use apt-cache-ng to serve upgrade deb files to the rest. How to let the head node keep the deb files after itself has upgraded?

Excuse me I have no clue after checking apt documents, seems autoclean is already disabled.

my /etc/apt/apt.conf.d/10periodic :
APT::Periodic::Update-Package-Lists “1”;
APT::Periodic::Download-Upgradeable-Packages “0”;
APT::Periodic::AutocleanInterval “0”;
APT::Periodic::Unattended-Upgrade “0”;

Appreciate your help !

This is certainly an apt.conf issue, though you should dig through both /etc/apt/apt.conf.d/* as well as /etc/apt/apt.conf itself.

I think this is what you want (NOTE: from man apt.conf):

       Defaults to on. When turned on the autoclean feature will remove any packages which
       can no longer be downloaded from the cache. If turned off then packages that are
       locally installed are also excluded from cleaning - but note that APT provides no
       direct means to reinstall them.

man apt-get seems to agree:

   autoclean (and the auto-clean alias since 1.1)
       Like clean, autoclean clears out the local repository of retrieved package files. The
       difference is that it only removes package files that can no longer be downloaded, and
       are largely useless. This allows a cache to be maintained over a long period without
       it growing out of control. The configuration option APT::Clean-Installed will prevent
       installed packages from being erased if it is set to off

Also from man apt.conf:

/usr/share/doc/apt/examples/configure-index.gz is a configuration file showing example values for all possible options.
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.