How to save an app and dependencies to a folder?

In PureOS, I want to download and save an app (for example qemu) along with its dependencies and subdependencies for later offline installation. How can I do that?

You can of course directly wget packages from a repo. But I assume you want auto dependency resolution. How about this:

To later install them from a directory, you need to make sure to

  • specify the path starting with / or ./ (or apt will assume a package name, not a path)
  • list all packages so that it will not attempt to download dependencies

apt install ./mycache/*


  • I did not test this specific scenario, but in general that should work
  • only dependencies that are not already installed will be fetched

Stack Overflow won’t always be around, or up, so the answer should probably be posted inline:

There’s the --download-only flag to apt install you can use, or the shortcut, apt download, which will download the .deb files to the current directory. I tried it with the qemu package, and it downloaded the deb, but no dependencies. I assume that because PureOS comes with GNOME Boxes that I already have the dependencies; some testing is needed to be sure it fetches dependencies.

So, put shortly:

mkdir -p /my/apt/cache
cd /my/apt/cache
sudo apt clean # optional
apt download $PACKAGE

Just like other apt operations, you can put multiple package names on the command line and it will fetch them all.