How to download a package using YUM in Linux ?

In this post we will see how to download the packages saved in YUM repository in linux.

There are two ways to achieve this.

1. Using downloadonly option with YUM.
However the drawback is that if this version is already installed, it will not be downloaded.

[root@ngelinux001 ~]# yum install --downloadonly --downloaddir=/tmp/ accountsservice
Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify,
              : versionlock
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Package accountsservice-0.6.50-7.el7.x86_64 already installed and latest version
Nothing to do
[root@ngelinux001 ~]# 

 

2. Using yumdownloader provided by yum-utils package.

a. Install the yum-utils package

[root@ngelinux001 ~]# yum install yum-utils
Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify,
              : versionlock
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-50.el7 will be updated
--> Processing Dependency: yum-utils-translations = 1.1.31-50.el7 for package: yum-plugin-aliases-1.1.31-50.el7.noarch
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be an update
--> Running transaction check
---> Package yum-plugin-aliases.noarch 0:1.1.31-50.el7 will be updated
---> Package yum-plugin-aliases.noarch 0:1.1.31-54.el7_8 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
 Package                              Arch                     Version                            Repository               Size
================================================================================================================================
Updating:
 yum-utils                            noarch                   1.1.31-54.el7_8                    base2                   122 k
Updating for dependencies:
 yum-plugin-aliases                   noarch                   1.1.31-54.el7_8                    base2                    32 k

Transaction Summary
================================================================================================================================
Upgrade  1 Package (+1 Dependent package)

Total size: 153 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : yum-utils-1.1.31-54.el7_8.noarch                                                                             1/4
  Updating   : yum-plugin-aliases-1.1.31-54.el7_8.noarch                                                                    2/4
  Cleanup    : yum-plugin-aliases-1.1.31-50.el7.noarch                                                                      3/4
  Cleanup    : yum-utils-1.1.31-50.el7.noarch                                                                               4/4
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                             1/4
  Verifying  : yum-plugin-aliases-1.1.31-54.el7_8.noarch                                                                    2/4
  Verifying  : yum-plugin-aliases-1.1.31-50.el7.noarch                                                                      3/4
  Verifying  : yum-utils-1.1.31-50.el7.noarch                                                                               4/4

Updated:
  yum-utils.noarch 0:1.1.31-54.el7_8

Dependency Updated:
  yum-plugin-aliases.noarch 0:1.1.31-54.el7_8

Complete!
[root@ngelinux001 ~]#

 

b. Now download the package.

[root@ngelinux001 ~]# yumdownloader accountsservice.x86_64
Loaded plugins: kabi, langpacks, product-id, subscription-manager, versionlock
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
accountsservice-0.6.50-7.el7.x86_64.rpm                                                                  |  99 kB  00:00:00
[root@ngelinux001 ~]# 

 

c. Check out the downloaded package.

[root@ngelinux001 ~]# pwd
/root

[root@ngelinux001 ~]# ls -ltr
total 124
-rw-r--r--  1 root root 101292 Oct  2  2019 accountsservice-0.6.50-7.el7.x86_64.rpm
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments