Posted by riteshsarraf on Sat 24 Oct 2009 at 14:43
This article is about Offline Package Management in Debian. Debian is a pretty well known project. One of the things that makes Debian very popular is APT (a.k.a Advanced Packaging Tool) which allows remote package downloads, upgrades and dependency resolution. Unfortunately it does require a network connection - unless you use apt-offline.
In Debian, when you need to install a package, you usually would fire up the apt-get command and the software would just install without any hand holding.
While APT is really very cool one of the main reasons for its success is the Debian Policy. The Debian Policy is like the brain of the project that controls the entire project ensuring that all the bits and pieces fit well together upto the Debian Standards. APT is just a result of the fantastic Debian Policy work.
In Debian, every package is very well self-contained and is tightly related to each other using APT. APT does a very good job of integrating and resolving dependencies for Package Management and takes off all the Dependency Hell problems from the user.
This is where the problem starts - for a machine which has network access it works very well because APT generates the list of packages and their dependencies and is able to download and install them successfully.
But when it comes to downloading a package individually on a different machine, along wih resolving any dependencies this can be a big problem.
Consider this real world example: I have a Debian box at home. At home, I have no (or very slow/expensive dial-up) internet connection. At work, I (or my friend) do have a very fast connection but (as part of IT policy) am required to use Windows.
I would still like to be able to painlessly update/upgrade my Debian box at home, with all the power and flexibility of APT.
This is where apt-offline is useful. apt-offline is an offline APT Package Manager.
Using apt-offline:
Let's start with a 3 step example
Step 1
Generate a signature file on the Disconnected Debian 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.
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 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.
Step 3
Once you're back upon the home Debian 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.
As you can see from the article above, apt-offline helps you achieve the power of APT, in just 3 steps. apt-offline is part of Debian and is developed at Alioth.
[ Parent ]
[ Parent ]
That's exactly what I wanted a few years ago. As it happens the PC I need it for now has fast network and I've migrated to using aptitude for all my upgrades now.
I can still see a need for this tool though, there is nothing worse than installing a box knowing that you have a nasty wait for the upgrades to come down a slow pipe - and a local cache of updated packages would always be useful.
--
"It's Not Magic, It's Work"
Adam
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
C:\Python31\Lib\site-packages\apt-offline>python apt-offl ine get .\tmp\apt-offline.sig --threads 5
Traceback (most recent call last):
File "apt-offline", line 25, in&n bsp;<module>
from apt_offline_core.AptOfflineCore Lib import main
File "C:\Python31\Lib\site-packages\apt-offline\ apt_offline_core\AptOfflineCor
eLib.py", line 242
except socket.timeout, timeout:
; &nbs p; ^
SyntaxError: invalid syntax
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
apt-offline set apt-offline.sig --updateon the Debian box and got the following message: Generating database of files that are needed for an update, which I assume is alright. I checked
apt-offline.sigwhich had a lot of lines like http://......, which I think ar URIs for the packages.
apt-offline get apt-offline.sig --bug-reports -d apt-offline_dlon Windows. This gave me errors wherever the directory i18n was involved -
apt-offline_dland found two files of size about 5MB.
apt-offline install apt-offline_dl --verboseon the Debian box and it completed without any errors. I also got the Great!!! No bugs found for all the packages that were downloaded. message.
apt-cache search wvdialHowever, I got no message. Looks like the cache was not updated. I also tried
apt-offline set apt-offline.sig --install-packages wvdialwhich gave me
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
apt-offline get C:\apt-offline.sig --threads 5But how am I supposed to get the program to work this way in cmd?
python apt-offlineWhat's the problem?
[ Parent ]
[ Parent ]
apt-offline install /media/USB/apt-offline.zipThe following error shows up:
ERROR: I couldn't understand file type extras.ubuntu.com_ubuntu_dists_raring_Release.gpgHelp would be greatly appreciated.
[ Parent ]
[ Parent ]
VERBOSE: Namespace(allow_unauthenticated=False, func=<function installer at 0x957f8ec>, install='apt-offline.zip', install_src_path=None, simulate=False, skip_bug_reports=False, verbose=True)Multiple messages printing:
VERBOSE: Cleaning data fileAnd then:
VERBOSE: {}
VERBOSE: Great!!! No bugs found for all packages that were downloaded.
ERROR: I couldn't understand file type extras.ubuntu.com_ubuntu_dists_raring_Release.gpg
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
I can't see where the windows download link is. Do I have to google for absolutely every single thing when working with linux?
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
thanks
[ Parent ]