Ubuntu: does apt-get checks cache directory before downloading packages [duplicate]


This question already has an answer here:

I wanted to do offline installation of some packages on an ubuntu machine which is not connected to internet. I have those packages on storage device. Can i use apt-get to install it

does apt-get checks cache directory before downloading packages?


If you have the packages (.deb files), apt-get is not the best tool. Read man dpkg and use dpkg -i to install the .deb files.


In general, I'd recommend using dpkg -i, as waltinator wrote and it's the safe and sane method.

However, if you have a vary large number of packages, and you wish to easily manage installing and uninstalling them, with dependency management, the following should work:

sudo apt-get -o dir::cache::archives=/path/to/directory/containing/archives/ -o dir::state::lists=/path/to/directory/containing/lists --no-download install your-packages  

In order for dependency management etc. to work properly, you may need to copy the package metadata (normally present at /var/lib/apt/lists/) to /path/to/directory/containing/lists on the offline computer.

You could also just copy the packages and the lists directly into the default directories /var/cache/apt/archives/ and /var/lib/apt/lists/, respectively, on the offline computer and skip the options part (-o dir::cache::archives=/path/to/directory/containing/archives/ -o dir::state::lists=/path/to/directory/containing/lists).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »