Debian APT Installs on Disconnected Systems

Notes on installing software using Debian/Ubuntu APT repositories on systems that aren't connected to the Internet.

This is a two-step process, because the software we want to use (apt-offline) isn't installed by Ubuntu Server by default.

So to bootstrap this on a server that doesn't have an Internet connection, we first need to manually retrieve the files needed to install apt-offline, and then we can use it for other software.

Source for most of this process

On the disconnected machine

Run this:

apt-get -y install --print-uris apt-offline | cut -d\' -f2 | grep http > apturls

Then, copy the resulting file ("apturls") to a networked machine, using whatever method is available. SCP, USB stick, NetCat... anything reliable, really. A USB stick if nothing else works.

On the networked machine

Use wget to download those files... `wget -i apturls` will pull down a bunch of .deb in the proper architecture for the other machine. Tar them up (or whatever) and move them back to the non-networked machine

Back on the disconnected machine

Note that as of Sept 2023, there's an issue in the current version of apt-offline in Ubuntu 22.04 (version 1.8.4), so after this I also installed the latest version from the Ubuntu 23 release (1.8.5) which fixes the issue (Hopefully this will be resolved soon... it's a Python 3.10 deprecation issue.)

Disconnected machine, again

On disconnected machine, create a "signature" file for the packages that you want to install:

sudo apt-offline set --install-packages wireguard --update wg.sig

Then copy that .sig file to the online/connected machine...

And networked machine, again

On the connected machine, which also has apt-offline installed, pull down the files and metadata into a "bundle":

apt-offline get wg.sig --bundle wg.zip

(Note that sudo is not needed on the internet-connected machine, since it's just pulling down files and zipping them up.)

Then take the resulting "bundle" file (zip archive) back to the disconnected machine...

Disconnected machine

Run:

sudo apt-offline install wg.zip

Note: That populates the APT cache but *does not actually install the packages* onto the system! (This confused the hell out of me.)

The final step is to run `sudo apt install PACKAGE` for whatever the name of the package was, to complete the install/configuration as normal.

Rinse and repeat as needed!

Metadata

Written: 2023-09-14

Updated: 2023-10-29

Converted From: Evernote

Tags: Linux, software