I used to work on updated system. So usually I update my system every forth night. To update the system I use “apt-get update” and “apt-get upgrade” command. But some time updation gets failed because of slow internet connection. In our office my PC is connected to a broadband connection with blazingly fast speed. So I think of downloading all the packages from my office PC to my home pc. But here comes the problem in our office we use windows and any other OS is not allowed there. Here comes the problem, while doing some more searches I found apt-offline package manager. It is a simple utilty you can use to download all the packages and install it on your machine which do not have internet connection.
First install apt-offline package on your system
sudo apt-get install apt-offline
Generate a signature file on the Disconnected Ubuntu box 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.
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 for you, an archive file with all 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.
On a Windows machine, you will need to install Python (if installation is not allowed, simply download the Python module, extract it and point the configuration path to the Python module). In addition, you also need to download the apt-offline package on the Windows machine.
Next, open a command prompt and “cd” to the “apt-offline” directory and run the above command.
Once you’re back upon the home Ubuntu 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 bye 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.