Many a times it happens that we intend to just download RPMs from a repository to act as cache and plan to install it later, may be at scheduled maintenance downtime window. How do you achieve that using yum? Use the following method:
Install the package including "downloadonly" plugin, if you don't have it already:
(RHEL5)
# yum install yum-downloadonly
(RHEL6)
# yum install yum-plugin-downloadonly
Run yum command with "--downloadonly" option as follows:
# yum install --downloadonly --downloaddir=<directory> <package>
--downloaddir argument is optional and without it by default, yum downloads all RPM updates in /var/cache/yum/ in rhel-{arch}-channel/packages.Also you still need to re-download the repodata if the repodata expires before you re-use the cache. By default it takes two hours to expire.
As an alternatively you can also use "yumdownloader" available in "yum-utils" package as follows:
Install the yum-utils package:
# yum install yum-utils
Run the command followed by the desired package:
# yumdownloader <package>
This works for packages already installed on system too. Also note that the package is saved in the current working directly by default; use the --destdir option to specify an alternate location and be sure to add --resolve if you need to download dependencies.
Install the package including "downloadonly" plugin, if you don't have it already:
(RHEL5)
# yum install yum-downloadonly
(RHEL6)
# yum install yum-plugin-downloadonly
Run yum command with "--downloadonly" option as follows:
# yum install --downloadonly --downloaddir=<directory> <package>
--downloaddir argument is optional and without it by default, yum downloads all RPM updates in /var/cache/yum/ in rhel-{arch}-channel/packages.Also you still need to re-download the repodata if the repodata expires before you re-use the cache. By default it takes two hours to expire.
As an alternatively you can also use "yumdownloader" available in "yum-utils" package as follows:
Install the yum-utils package:
# yum install yum-utils
Run the command followed by the desired package:
# yumdownloader <package>
This works for packages already installed on system too. Also note that the package is saved in the current working directly by default; use the --destdir option to specify an alternate location and be sure to add --resolve if you need to download dependencies.
No comments:
Post a Comment