Как автоматически очищать кэш APT после каждой операции.
Удалять каждый файл из кэша APT после каждого выполнения dpkg.
$ sudo tee /etc/apt/apt.conf.d/00_disable-cache-directories << EOF DPkg::Post-Invoke {"echo 'Purging APT cache'; find /var/cache/apt/archives/ -type f -delete"} EOF
DPkg::Post-Invoke {"echo 'Purging APT cache'; find /var/cache/apt/archives/ -type f -delete"}
Выполните операцию установки apt.
$ sudo apt install packer
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: chromium-codecs-ffmpeg-extra gir1.2-gnomebluetooth-1.0 gstreamer1.0-vaapi libflashrom1 libftdi1-2 libgstreamer-plugins-bad1.0-0 libllvm13 ltrace Use 'sudo apt autoremove' to remove them. Suggested packages: ansible qemu-system The following NEW packages will be installed: packer 0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded. Need to get 17.4 MB of archives. After this operation, 106 MB of additional disk space will be used. Get:1 http://pl.archive.ubuntu.com/ubuntu jammy/universe amd64 packer amd64 1.6.6+ds1-4 [17.4 MB] Fetched 17.4 MB in 1s (21.0 MB/s) Selecting previously unselected package packer. (Reading database ... 210130 files and directories currently installed.) Preparing to unpack .../packer_1.6.6+ds1-4_amd64.deb ... Unpacking packer (1.6.6+ds1-4) ... Setting up packer (1.6.6+ds1-4) ... Processing triggers for man-db (2.10.2-1) ... Purging APT cache
Обратите внимание, что команды apt, при которых не выполняется dpkg, не вызывают дополнительных операций.
$ sudo apt install kvmtool --download-only
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: chromium-codecs-ffmpeg-extra gir1.2-gnomebluetooth-1.0 gstreamer1.0-vaapi libflashrom1 libftdi1-2 libgstreamer-plugins-bad1.0-0 libllvm13 ltrace Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: kvmtool 0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded. Need to get 89.4 kB of archives. After this operation, 265 kB of additional disk space will be used. Get:1 http://pl.archive.ubuntu.com/ubuntu jammy/universe amd64 kvmtool amd64 0.20170904-1.1 [89.4 kB] Fetched 89.4 kB in 0s (672 kB/s) Download complete and in download only mode
$ sudo ls /var/cache/apt/archives/
kvmtool_0.20170904-1.1_amd64.deb lock partial
см. также:
- 📦 Как проверить версию установленного пакета в Ubuntu/Debian
- 📦 Как использовать команду apt search на Linux
- 🐧 Как добавить репозиторий программного обеспечения Microsoft для Linu
- 📦 Как вывести список всех пакетов, доступных в репозитории Ubuntu и Debian