从yum源中下载软件

转自https://access.redhat.com/solutions/10154

 

How to use yum to download a package without installing it

 SOLUTION VERIFIED - Updated October 22 2015 at 2:36 PM - 

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 5

Issue

  • How do I use yum to download a package without installing it?

Resolution

There are two ways to download a package without installing it.

One is using the "downloadonly" plugin for yum, the other is using "yumdownloader" utility.

Downloadonly plugin for yum

  1. Install the package including "downloadonly" plugin:

    Raw
    (RHEL5)
    # yum install yum-downloadonly
    
    (RHEL6)
    # yum install yum-plugin-downloadonly
    
  2. Run yum command with "--downloadonly" option as follows:

    Raw
    # yum install --downloadonly --downloaddir=<directory> <package>
    
  3. Confirm the RPM files are available in the specified download directory.

Note:

  • Before using the plugin, check /etc/yum/pluginconf.d/downloadonly.conf to confirm that this plugin is "enabled=1"
  • This is applicable for "yum install/yum update" and not for "yum groupinstall". Use "yum groupinfo" to identify packages within a specific group.
  • If only the package name is specified, the latest available package is downloaded (such as sshd). Otherwise, you can specify the full package name and version (such as httpd-2.2.3-22.el5).
  • If you do not use the --downloaddir option, files are saved by default in /var/cache/yum/ in rhel-{arch}-channel/packages
  • If desired, you can download multiple packages on the same command.
  • 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.

Yumdownloader

If downloading a installed package, "yumdownloader" is useful.

  1. Install the yum-utils package:

    Raw
    # yum install yum-utils
    
  2. Run the command followed by the desired package:

    Raw
    # yumdownloader <package>
    

Note:

  • The package is saved in the current working directly by default; use the --destdir option to specify an alternate location.
  • Be sure to add --resolve if you need to download dependencies.
  • Component  
  • yum

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

转载于:https://www.cnblogs.com/zhchy89/p/11578044.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值