Install a program with apt-offline

Solution 1:

To install the package vim you have first to create a signature for the installation on the off line machine:

sudo apt-offline set vim-offline.sig --install-packages vim

Then on the on line machine you download the packages:

apt-offline get vim-offline.sig --bundle vim-install.zip

Finally on the off line machine you install it:

sudo apt-offline install vim-install.zip

Vim and all its dependencies should have been installed properly on the off line machine.

Solution 2:

The sig file has information on updating the certain package with a database, but it does not hold the actual package if you did not have it previously installed. The overall steps are:

Step 1 (Already Completed by OP)

Generate a signature file on the disconnected machine at home:

apt-offline set /tmp/apt-offline.sig

The above command will generate all information required from apt about updating its database.

By default, with no additional arguments passed, apt-offline will extract information about APT Package Database Update i.e. the --update option as well as the list of Packages to be upgraded i.e. the --upgrade option.

These options can also be individually passed if you want only one of those.

Step 2

Download data based on the signature file generated earlier:

apt-offline get C:\apt-offline.sig --threads 5

The above command will download data as mentioned in the signature file. To speed up downloads (that can be from multiple apt repositories), in this example, we spawn 5 download threads.

Note: It would be good to also download the bug reports for the packages that you are downloading. So that example now becomes:

apt-offline get C:\apt-offline.sig --bug-reports --threads 5

There are many more options that you can pass to apt-offline, like the --bundle option which would generate an archive file with all of the data.

Once completed, you could just copy the data (an archive file, if you used the --bundle option) back to the removable medium and copy it back onto your offline host.

Step 3

Once you're back upon the home machine, you feed the data from the removable medium to apt-offline:

apt-offline install /media/USB/apt-offline.zip

This will update the APT database on your disconnected machine seamlessly.

If there were packages that needed to be upgraded, now they would all be available (with dependencies) in the APT database. So, if you do an apt-get upgrade now, APT won't prompt you mentioning even a single byte download. APT would find that all required packages are already present in the APT cache.

If you had used the --bug-reports switch that I mentioned earlier, during install, apt-offline would prompt you with the list of bug reports related to the packages on your machine that need be upgraded/installed - not just the list, but the full bug report will be available for you to look at and evaluate the severity involved.

All credit goes to Offline Package Management for APT.