yumdownloader and yum-downloadonly

That’s right, a couple of packages that let you download packages using yum instead of installing or upgrading them. Nice article on Nixcraft entitled How To Download a RPM Package Using yum Command Without Installing On Linux giving the full scoop.

The simpler of the two is the yumdownloader utility, provided by yum-utils. Install that with:

yum install yum-utils

Using it is as easy as:

yumdownloader perl-ldap

This downloads to your present working directory (pwd).

A bit more flexible is yum-downloadonly, install by executing:

yum install yum-downloadonly

Then you’re ready to go.

For example:

 yum update perl-ldap -y --downloadonly

This will download to default directory, /var/cache/yum. To specify a different location:

yum update httpd -y --downloadonly --downloaddir=/var/tmp

Another neat trick the article relates is something I’d forgotten: how to extract a package contents.

rpm2cpio httpd-2.2.3-31.el5_4.2.x86_64.rpm | cpio -idmv