I want to force caching the installed packages with apt-get install (apt install)
in /var/cache/apt
. Currently, I found some of them are cached, but most of them are not. I want to cache all of them to install them on another machine by copying these packages without downloading them again from the Internet, especially for large packages which cost a lot of time.
1 Answer
I think that setting up your local machine as a repository would be a better option, but if you want to just download a package you can run:
sudo apt install -d package
If you want to cache all of your installed packages you can run
sudo apt install -d $(apt list --installed | cut -d'/' -f 1 | grep -v "Listing..." | tr '\n' ' ')
apt
command doesn't cache the deb files by default, but theapt-get
command does, so useapt-get
and onlyapt-get
if you want everything to be cached, or change the config as shown in askubuntu.com/a/794987/158442