APT Package Management – Where Are Installed Packages Stored?

aptpackage-management

As time goes by we tend to do apt-get install and add or replace software.

Are these archived in some form or do they get auto-cleared after installation? And if it doesn't get auto-cleared, it would mean that a clean up is needed, isn't it?

Finally, if they're not auto-removed, can we reuse these packages on different machines?

Best Answer

The downloaded packages are stored in /var/cache/apt/archives

If you want to remove them, use sudo apt-get clean.

From man apt-get:

clean

clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When APT is used as a dselect(1) method, clean is run automatically. Those who do not use dselect will likely want to run apt-get clean from time to time to free up disk space.

autoclean

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.

Related Question