--print-uris
apt-get --print-uris --yes
- --print-uris : instead of fetching the files to install, their URIs (links to download them) are printed. Each URI will have the path, the destination file name, the size and the expected md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.
--yes or -y : automatically yes to prompts; assume "yes" as answer to all prompts and run non-interactively.
- -qq : quiet. It implies -y .
Links to a package
To get the URIs (links) of all the files needed to install a package (i.e. ExamplePackage), use:
apt-get --print-uris --yes install ExamplePackage > packageuri.htm
You can also give more than one package name.
myurilist.htm can be stored in a USB flash drive, to be used in a computer with Internet connection to click in the URIS (links) and download the packages.
You can use grep and cut to extract the URIs from the output
apt-get --print-uris --yes install ExamplePackage | grep ^\' | cut -d\' -f2 > packageuri.htm
Links to update the package index
apt-get --print-uris update > myupdateurilist.htm
When you have downloaded the new index, store it in /var/lib/apt/lists (after save a backup copy of it in /var/lib/apt/lists.old ).
Links to fix broken packages
apt-get --fix-broken > mybrokenpackagesurilist.htm
Links to update distribution
Recommended
apt-get dist-upgrade > mydisturilist.htm
Dowloading
You can click in the links in the htm file or download the files using Wget.
wget --input-file myurilist.htm
Installation in the local machine
You can install the dowloaded packages manually (clicking in the files in Nautilus, that employs Gdebi) or automatically in a terminal:
apt-get -o dir::cache::archives="/disc" dist-upgrade
- /disc is the place where you have the downloaded packages (i.e. the removable media, as a USB keydrive).