Tuesday, March 29, 2011

Download RPM packages from a YUM repo without installing in RHEL

Download RPM packages using YUM


This how-to will explain how to download rpm packages from a yum repository without installing them. This will work on Redhat Enterprise Linux 5.x, Fedora and CentOS 5.x.

You need to install yum plugin called yum-downloadonly. This plugin adds a --downloadonly flag to yum so that yum can download the packages without installing/updating them. Following options supported by this plugin:

  • --downloadonly : don't update, just download a rpm file to default yum cache directory /var/cache/yum/.
  • --downloaddir=/path/to/dir : specifies an alternate directory to store packages such as /tmp
Install the yum-downloadonly plugin:

Type the following command to install plugin, enter:

        # yum install yum-downloadonly

Now for downloading rpm packages from an already configured yum repository use the following command:

      # yum update httpd -y --downloadonly