Follow this article’s detailed guidelines to disable apt cache in Debian.
How to Disable APT Cache in Debian
An easy step-by-step instruction to disable apt cache in Debian is given below:
Step 1: First, you must create a 00clean-cache-dir file on the Debian system through nano editor:
Step 2: Within the file, you must add the following line:
Step 3: Then save the clean cache file using “CTRL+X”, add “Y” and enter to exit.
Step 4: Then you have to create another file with “00disbale-cache-files” name:
Step 5: Within this file, add the following lines:
Step 6: Save this file using Step 3.
This will disable the apt cache on the Debian system.
Step 7: Now the apt cache is disabled now, it’s better to empty the ‘/var/cache/apt/archives’ directory on Debian using the following command:
Step 8 (Optional): Alternatively, it’s a good practice if you run the following command to delete the cache:
Step 9 (Optional): Further you can also remove the cache files and directories through the following command:
Step 10 (Optional): Let’s clean the system by removing the cache file and directories using the following command.
The apt cache on Debian can be disabled easily by creating a clean cache file inside the /etc/apt/apt.conf.d/ location. Then create another file with disable cache in the home location. Save both these files to disable the apt cache on Debian. It’s better to remove cache files and directories through “rm -rf” command or some apt commands that are optional but good practice if you run them on the terminal.