1

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?

2

2 Answers 2

2

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.

1

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 .