When using apt-get
to install or upgrade a package, a copy of that package (the .deb file) will be saved in: /var/cache/apt/archives
but when using apt
command it's just download and installs the requested package and nothing will be saved in /var/cache/apt/archives
.
Is it the default behavior of apt
command?
Is there any switch/config to makes apt
cache the deb files? (to have a backup of deb files)
I'm running: ubuntu 16.04.2 LTS - With all updates.
What you've reported could be a consequence of a bug filed way back in 2002, apt: apt-get clean should run weekly
The apt package cache grows without bound; "apt-get clean" should be run regularly (a script in /etc/cron.weekly would be fine). Without such a script, apt runs the danger of filling up smaller disks, especially on systems run by less experienced Debian adminstrators.
This was reported fixed in 2016.
However, the code suggested to prevent the automatic removal of .debs after successful installation of the package needed further work as a result of another bug, New option in apt "APT::Keep-Downloaded-Packages" is ignored.
The new option "APT::Keep-Downloaded-Packages" is ignored in configuration item "Dir::Etc::Parts" and in configuration item "Dir::Etc::Main".
Those interested may read the bugs and also /usr/share/doc/apt/NEWS.Debian.gz
on your system (which can be opened by right-clicking and choosing "Open with gedit").
On my fully updated 16.04 LTS, apt policy
has:
apt:
Installed: 1.2.19
Candidate: 1.2.19
and /usr/share/doc/apt/NEWS.Debian.gz
has:
apt (1.2~exp1) experimental; urgency=medium
[ Automatic removal of debs after install ]
After packages are successfully installed by apt(8),
the corresponding .deb package files will be
removed from the /var/cache/apt/archives cache directory.
This can be changed by setting the apt configuration option
"Binary::apt::APT::Keep-Downloaded-Packages" to "true".
E.g:
# echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ > /etc/apt/apt.conf.d/01keep-debs
Please note that the behavior of apt-get is unchanged. The
downloaded debs will be kept in the cache directory after
they are installed. To enable the behavior for other tools,
you can set "APT::Keep-Downloaded-Packages" to false.
It maybe worth noting that apt
is still evolving vis-à-vis apt-get
and that users going this route should keep checking to see if code used in previous versions still works in the future.
No comments:
Post a Comment