Download RPM packages from a YUM repo without installing

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
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


Method 2: yum-utils.noarch Package

Downloading rpm packages from a yum repository can be accomplished by the below described method also!!!

yum-utils is a collection of utilities and examples for the yum package manager. It includes utilities by different authors that make yum easier and more powerful to use. These tools include: debuginfo-install, package-cleanup, repoclosure, repodiff, repo-graph, repomanage, repoquery, repo-rss, reposync, repotrack, verifytree, yum-builddep, yum-complete-transaction, yumdownloader, yum-debug-dump and yum-groups-manager.

     # yum -y install yum-utils.noarch

Now use the yumdownloader command which is a program for downloading RPMs from Yum repositories. Type the following command to download httpd rpm file:

     # yumdownloader httpd

Sample output:

Loaded plugins: rhnplugin
httpd-2.2.3-31.el5_4.2.x86_64.rpm       1.2 MB 00:00

 

转载于:https://www.cnblogs.com/oskb/p/3772135.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值