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?

marked as duplicate by muru, Eric Carvalho, karel, Pilot6, David Foerster Jul 6 '17 at 9:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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).

Not the answer you're looking for? Browse other questions tagged or ask your own question.