Skip to content

Instantly share code, notes, and snippets.

@Amar1729
Created December 10, 2019 23:30
Show Gist options
  • Save Amar1729/70188f09ec2283aaebf26ca942989886 to your computer and use it in GitHub Desktop.
Save Amar1729/70188f09ec2283aaebf26ca942989886 to your computer and use it in GitHub Desktop.
Offline Ubuntu pkg installation

Download APT packages for an offline Ubuntu install

A fairly straightforward way to do this - short of spinning up a VM - is to use a docker image, e.g.:

# use whatever ubuntu version you are targeting, although there may be pkg version differences:
$ docker run -it ubuntu:18.04

# using docker makes things like spin up/copying text/deleting images faster, but keep in mind a few gotchas:

# _may_ have to install wget (if downloading signing keys)
$ apt install wget

# needs gnupg if using apt-key add
# apt install gnupg2

Then, (in the VM or docker image) download the apt packages without installation:

$ apt update

$ apt install --download-only <package>

# results found in:
$ ls -lh /var/cache/apt/archives

After this you can safely transfer the .deb files in /var/cache/apt/archives/ wherever you need.

(Note, if using docker, there is a docker cp command to copy files from a container to host).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment