If you want to install Linux many times with the same configuration, debootstrap the system first with the
--foreign option when installing. e.g. the following bootstraps Ubuntu zesty into the directory "deboot"
sudo debootstrap --foreign zesty deboot
You can then keep the deboot dir as a reference and copy it to a new working dir each time you want to reuse it and use the
sudo cp -r ../deboot .
sudo DEBOOTSTRAP_DIR=deboot/debootstrap/ debootstrap --second-stage --second-stage-target $(readlink -f deboot)
Two things to note here are the
DEBOOTSTRAP_DIR environment variable that the
debootstrap script uses (but doesn't document very well) and that the
second-stage-target option requires a full path.
An alternative option is to use the parameter
--make-tarball=[file] which allows you to download the packages and then use
--unpack-tarball=[file] to put those packages in the target dir.
If you want to reuse your cache from some other source or shared folder use apt-proxy or cp -a packages /var/cache/apt/archives/, however, this isn't fully offline as
debootstrap will still try to connect to the interent to get the
InRelease file from the remote repo.