Both Debian and RPM based package management systems have utility’s that allow packages to be downloaded and not installed. These packages can then be installed later. This is useful if you have limited bandwidth or if you want to perform an upgrade on several systems which have the same package structure at a later time.
Downloading RPM packages using yum
RPM based distributions such as Fedora and Red Hat have a package manager called YUM which has a secondary utility called yumdownloader. By typing the following command you can download a rpm package.
$ yumdownloader –destdir=/opt zsh
$ ls /opt/zsh*
This will download the latest zsh package found in yums repository’s. The option –destdir tells yumdownloader where to save the package. In this case zsh is saved in the /opt directory. Its worth noting that you dont need to know the full package file name.
The zsh package can then be installed in the normal manner using rpm
Downloading Debian packages using apt-get.
Debian based distributions which use the APT package manager keep a cache of packages on the local system. This cache is stored in /var/cache/apt/archives/ and its where the packages are held before they are installed. Using the -d option tells APT to download the package and not to install it.
$ apt-get install -d zsh
$ sudo apt-get install -d zsh
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
Use ‘apt-get autoremove’ to remove them.
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,470 kB of archives.
After this operation, 13.9 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/oneiric/main zsh i386 4.3.11-4ubuntu2.is.3ubuntu2 [4,470 kB]
Fetched 4,470 kB in 5s (774 kB/s)
Download complete and in download only mode
This results in the latest zsh package being downloaded to /var/cache/apt/archives/
$ ls /var/cache/apt/archives/zsh*
This package can the be installed using dpkg as normal.