Can i automatically clean cache of apt archives?

If /var/cache/apt/archives is mounted in RAM, you can let APT auto clean it after each successful install or upgrade. Create a small config file:

sudo mkdir -p /etc/apt/apt.conf.d
echo 'APT::Clean-Installed "true";' | sudo tee /etc/apt/apt.conf.d/99clean

From now on, apt will clean out downloaded packages it no longer needs after installs/updates, so your RAM-backed cache will not keep growing.

also since it’s in tmpfs, anything left there also disappears on reboot so you don’t need extra cron jobs or scripts.

3 Likes