apt-offline
You can use apt-offline to install packages on an air-gapped host or to update/upgrade it. This tool is very handy, because it does not require the same Ubuntu version on both hosts (online/air-gapped).
Prerequisites
Install apt-offine on your online host:
sudo apt install apt-offline
Download apt-offline for your air-gapped host from:
https://packages.ubuntu.com/jammy/all/apt-offline/download
Make sure to replace jammy by the actual codename of your air-gapped host. You can query it with lsb_release -c.
Transfer the downloaded apt-offline package to your air-gapped host and install it:
sudo dpkg -i apt-offline_1.8.4-1_all.deb
Update
To update the package lists on your air-gapped host:
Create a signature file for that task on your air-gapped host:
sudo apt-offline set apt-offline.sig --update
Move that file to your online host and download the files for an offline update:
apt-offline get apt-offline.sig --bundle bundle.zip
Move the bundle from your online host to your air-gapped host and install it:
sudo apt-offline install bundle.zip
Install packages
To install packages on your air-gapped host, just do the same as for updating, but create a signature file for installation instead. E. g. for packages git and g++:
sudo apt-offline set apt-offline.sig --install-packages git g++
After you imported the bundle on your air-gapped host, you can run apt install as usual:
sudo apt install git g++
Upgrade
To upgrade your air-gapped host, just do the same as for updating, but create a signature file for upgrade instead:
sudo apt-offline set apt-offline.sig --upgrade
After you imported the bundle on your air-gapped host, you can run apt upgrade as usual:
sudo apt upgrade