Print Friendly, PDF & Email

 
QUESTIONS

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

 
RELATED

 
SOLUTION

You can use both yum downloadonly plugin and yumdownloader utility

 
TESTCASE
 

Downloadonly plugin

Create a directory for a package to be downloaded

[root@dbpilot ~] mkdir /oracle/prerequesits

Install downloadonly plugin

# (RHEL5)
# yum install yum-downloadonly

# (RHEL6)
# yum install yum-plugin-downloadonly

# (RHEL7)
# In RHEL7 downloadonly is included in yum itseft

Download wanted packages into the created directory

# (RHEL5 and RHEL6)
# yum install --downloadonly --downloaddir=/oracle/prerequesits vim

# (RHEL7)
# yum install --downloadonly --downloaddir=/oracle/prerequesits vim

[root@dbpilot ~] yum reinstall --downloadonly --downloaddir=/oracle/prerequesits vim
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.160-1.el7 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                Arch             Version                     Repository                        Size
============================================================================================================
Reinstalling:
 vim-enhanced           x86_64           2:7.4.160-1.el7             OEL73_x64_NETWORK_REPO           1.0 M

Transaction Summary
============================================================================================================
Reinstall  1 Package

Total download size: 1.0 M
Installed size: 2.2 M
Background downloading packages, then exiting:
vim-enhanced-7.4.160-1.el7.x86_64.rpm                                                | 1.0 MB  00:00:00
exiting because "Download Only" specified

NOTE: In RHEL7 you need to use reinstall option to download packages that are already installed.

Verify the downloaded package

[root@dbpilot ~] ls /oracle/prerequesits
vim-enhanced-7.4.160-1.el7.x86_64.rpm

 

Yumdownloader

Install yumdownloader package by

[root@dbpilot ~] yum install yum-utils

Download the wanted package

[root@dbpilot ~] yumdownloader --destdir=/oracle/prerequesits --resolve mlocate
--> Running transaction check
---> Package mlocate.x86_64 0:0.26-6.el7 will be reinstalled
--> Finished Dependency Resolution
mlocate-0.26-6.el7.x86_64.rpm                                   | 112 kB  00:00:00

Verify the downloaded package

[root@dbpilot ~] ls /oracle/prerequesits
mlocate-0.26-6.el7.x86_64.rpm  vim-enhanced-7.4.160-1.el7.x86_64.rpm

 
REFERENCES

How to use yum to download a package without installing it.
Unable to find “yum-plugin-downloadonly” plugin package for RHEL7.

 
 

Version  : 15:30 05.02.2018
Platform : RHEL5-RHEL7