Is there a recommended process for being able to install Ubuntu packages along their transitive dependencies, in an air-gapped IT environment having no direct Internet connectivity?

I can think of two challenges -

  1. Bundling up each package of interest along its recursive set of dependencies, for delivery into the air-gapped environment

  2. Setting up the target Ubuntu servers not to look for packages from the Internet but rather using the bundle from (1), or, setting up an internal download service which the target servers will reach out to instead of the Internet servers normally serving up packages

Your comments much appreciated!


Apt can use repositories on your local file system.

You would need to create the repo and know the packages you want to install on a computer with Internet access and apt-get.

apt-get -d install [packages]
mkdir /media/usb/MyRepo
cp -a /var/cache/apt/archives/*.deb /media/usb/MyRepo
dpkg-scanpackages /media/usb/MyRepo /dev/null > /media/usb/MyRepo/Packages

Now MyRepo can act as a repository. Transfer the directory to the system you need to install on such as on a USB drive. Then

echo "deb file:///media/usb/MyRepo ./" > /etc/apt/sources.list.d/myrepo.list
apt-get update
apt-get install [packages]

There are other tools that you can install separately such as apt-medium for shared caches, apt-mirror for mirroring repos etc.

  • Wow this is really cool. I should accept the answer after I try it! so basically this delivers a repository with all of the packages I've chosen plus those required them, to the local machine, and then any such package can be installed on the local machine from that local repository, right? – matt Dec 30 '17 at 7:32
  • 1
    Yep, It will use the packages from your repo so long as they are newer than other repos. Although I forgot to mention that this assumes the first machine has the same architecture as the second. – jdwolf Dec 30 '17 at 13:38
  • Of course. Do you mean architecture as in x86-64? – matt Dec 31 '17 at 16:39
  • 1
    @matt yes like that and others. If you wanted to get i386 on an x86_64 machine you'd have to do dpkg --add-architecture i386 then apt-get update && apt-get -d install [package]:i386 – jdwolf Dec 31 '17 at 19:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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