9

I have been researching about offline package management and followed the apt-offline tutorials as this. For all documentations say that let create a signature on offline machine like this: apt-offline set /tmp/apt-offline.sig and this will generate all information required from apt about updating its database. I have done this. But I want to do apt-get install vim, for example. How can we generate the signature to install vim? I could not find the main reason I am using apt-offline. Any help is appreciated

4 Answers 4

14

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.

1
  • 2
    after doing above steps I used apt-get install <packageName> and it installed package from apt cache Aug 21, 2019 at 6:21
3

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.

0

I've struggled enough with apt-offline. Instead I propose to just copy everything or only the relevant from /var/cache/apt/archives/*.deb from another partition or machine with same parameters where these are available to the same location on your system. Then just run

apt get install name_of_your_packages`

and enjoy. This will work because apt install will first look in these directories. I hope this helped, if so, +1, like, spread the world!

0

Adding to @TheOdd's great answer, I also needed to install apt-offline itself offline. To do this for example on Ubuntu 20.04, I found the packages I needed:

https://packages.ubuntu.com/kinetic/apt-offline

https://packages.ubuntu.com/kinetic/python3-magic

Then found and downloaded the deb files from here:

https://ubuntu.pkgs.org/20.04/ubuntu-universe-amd64/apt-offline_1.8.2-1_all.deb.html

https://ubuntu.pkgs.org/20.04/ubuntu-main-amd64/python3-magic_0.4.15-3_all.deb.html

And manually copied to my offline machine and installed the deb packages with dpkg -i command. Don't just use the GUI to install deb files as it might fail to report errors.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .