Server Side

Server related posts

Downloading Debian or RPM packages without installing them

Written by: Peter Fisher on February 19, 2012
Tagged under: , , , , , ,
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Linux penguin Tux

The Linux penguin is called Tux. He is the official mascot of the Linux kernel. Tux was originally created by Larry Ewing in 1996

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.

[crayon lang=”bash”]
$ yumdownloader –destdir=/opt zsh
[/crayon]

[crayon lang=”bash”]
$ ls /opt/zsh*
zsh-4.3.15-1.f16.i686.rpm
[/crayon]
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.

[crayon lang=”bash”]
$ apt-get install -d zsh
[/crayon]

[crayon lang=”bash”]
$ 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:
linux-headers-3.0.0-15 linux-headers-3.0.0-15-generic
Use ‘apt-get autoremove’ to remove them.
Suggested packages:
zsh-doc
The following NEW packages will be installed:
zsh
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
[/crayon]

This results in the latest zsh package being downloaded to  /var/cache/apt/archives/

[crayon lang=”bash”]
$ ls /var/cache/apt/archives/zsh*
/var/cache/apt/archives/zsh_4.3.11-4ubuntu2.is.3ubuntu2_i386.deb
[/crayon]

This package can the be installed using dpkg as normal.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Peter Fisher is a web developer working in Gloucester UK. Founder of the digital agency Websomatic, author of this blog and the HowToCodeWell Youtube channel. Peter has over ten years of web development experience under his belt

Read all about Peter Fisher

Leave a Reply

Your email address will not be published. Required fields are marked *