Q.
I would like to only download the packages via yum and not install/update them. How do I download a RPM package using yum command under CentOS Enterprise Linux server 5.x or RHEL 5.x systems?
A. You need to install plugin called yum-downloadonly. This plugin adds a --downloadonly flag to yum so that yum will only download the packages and not install/update them. Following options supported by this plugin:
A. You need to install plugin called yum-downloadonly. This plugin adds a --downloadonly flag to yum so that yum will only download the packages and not install/update them. Following options supported by this plugin:
[a] --downloadonly : don't update, just download a rpm file
[b] --downloaddir=/path/to/dir : specifies an alternate directory to store packages such as /tmp
[b] --downloaddir=/path/to/dir : specifies an alternate directory to store packages such as /tmp
Please note following instructions are only tested on CentOS server but should work with RHN and RHEL without any problem.
How do I install yum-downloadonly plugin?
Type the following command to install plugin, enter:
Sample output:
# yum install yum-downloadonly
Sample output:
How do I download a RPM package only from RHN or CentOS mirror, without installing it?
Download httpd package but don't install/update, enter:
By default package will by downloaded and stored in /var/cache/yum/ directory. But, you can specifies an alternate directory to store packages such as /opt, enter:
Sample output:
# yum update httpd -y --downloadonly
By default package will by downloaded and stored in /var/cache/yum/ directory. But, you can specifies an alternate directory to store packages such as /opt, enter:
# yum update httpd -y --downloadonly --downloaddir=/opt
Sample output:
To see downloaded file, enter:
Sample output:
# ls -l /opt/*.rpm
Sample output:
本文转自yahoon 51CTO博客,原文链接:http://blog.51cto.com/yahoon/87189,如需转载请自行联系原作者