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?

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

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:
# yum install yum-downloadonly
Sample output:

Loading "fastestmirror" plugin
Loading "security" plugin
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.tds.net
 * updates: mirror.myriadnetwork.com
 * addons: mirrors.gigenet.com
 * extras: holmes.umflint.edu
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package yum-downloadonly.noarch 0:1.1.10-9.el5.centos set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

 Package                 Arch       Version          Repository        Size 
 yum-downloadonly        noarch     1.1.10-9.el5.centos  base              9.0 k

Transaction Summary
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 9.0 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): yum-downloadonly-1 100% |=========================| 9.0 kB    00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: yum-downloadonly             ######################### [1/1] 

Installed: yum-downloadonly.noarch 0:1.1.10-9.el5.centos

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

yum install httpd -y --downloadonly 
Loading "downloadonly" plugin
Loading "fastestmirror" plugin
Loading "security" plugin
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.mypsh.com
 * updates: mirror.steadfast.net
 * addons: mirrors.gigenet.com
 * extras: holmes.umflint.edu
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-11.el5_1.centos.3 set to be updated
filelists.xml.gz          100% |=========================| 2.8 MB    00:03     
filelists.xml.gz          100% |=========================| 681 kB    00:11     
filelists.xml.gz          100% |=========================| 122 kB    00:00     
filelists.xml.gz          100% |=========================|  150 B    00:00     
--> Finished Dependency Resolution

Dependencies Resolved

 Package                 Arch       Version          Repository        Size 
 httpd                   i386       2.2.3-11.el5_1.centos.3  base              1.1 M

Transaction Summary
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 1.1 M
Downloading Packages:
(1/1): httpd-2.2.3-11.el5 100% |=========================| 1.1 MB    00:01     

exiting because --downloadonly specified 

To see downloaded file, enter:
# ls -l /opt/*.rpm
Sample output:

-rw-r--r-- 1 root root 1116426 Jan 17 03:36 /opt/httpd-2.2.3-11.el5_1.centos.3.i386.rpm
-rw-r--r-- 1 root root   83452 Oct  2  2007 /opt/lighttpd-fastcgi-1.4.18-1.el5.rf.i386.rpm
-rw-r--r-- 1 root root  635045 Oct 20  2007 /opt/psad-2.1-1.i386.rpm

Method # 2: yum-utils.noarch Package

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

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

How Do I Extract Downloaded RPM File?

Type the command as follows:
# rpm2cpio httpd-2.2.3-31.el5_4.2.x86_64.rpm | cpio -idmv

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 39 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
39 comments… add one
  • Grrruk Oct 6, 2008 @ 8:40

    Damn… it doesn’t work on CentOS 4.6. Is there way to do this on 4.x branch? Upgrading OS is not an option and yum install yum-downloadonly does not work…

    • Nick Webb Nov 21, 2011 @ 1:51

      I just did this today on CentOS 4.x… you can’t really do the same thing, but you can download all the needed updates to a directory, then install at your leisure with ‘rpm -Uvh *.rpm’. Here is the command I used:

      yum check-update | egrep ‘(base|updates)’ | awk ‘{ print $1 }’ | xargs -n 10 yumdownloader

  • 🐧 nixCraft Oct 6, 2008 @ 13:14


    Noop, the only way to get it by visiting centos http / ftp mirrors.

  • LAMP setup: Beginning | www.redips.net Dec 5, 2008 @ 12:54

    That is what I’m looking for. I have FC10 desktop at my work place, and another FC10 at my home. This way I could spare my home bandwidth …
    Thank you!

  • ashu Jan 17, 2009 @ 12:34

    Jai Hind

    Thanks vivek for this very cool and useful trick

  • Arun Kumar Feb 26, 2009 @ 17:34

    I have some packages which are installed using yum command. Now, I installed downloadonly plug-in. How can I download these packages without uninstalling the installed packages?

  • keLz Mar 7, 2009 @ 8:34

    This doesnt work if you already have the package.
    Is there a way around this?

    • Golda Oct 29, 2010 @ 12:54

      You can do
      yum reinstall [package] –downloadonly
      and it will stop during the reinstall and leave the package in a subdirectory of
      this worked better for me than using –installroot

      • asdf@asdf.tld Apr 19, 2011 @ 13:31

        reinstall <<< omg this is brilliant.

        so obvious so simple. there are thousands of posts on the internet that say you can't force install using yum if you already have the package installed, yet your needled in the haystack post, proves them all wrong.

        this worked for me. i accidently erased 1 file from a package. i just need to put that one file back, so i used the reinstall option, and the download only option, and then extracted the rpm package, and placed that one single file back. brilliant.


        • asdf@asdf.tld Apr 19, 2011 @ 13:36


          a quick followup, I wanted to download a copy of the package rpm that I already have installed, so I did a

          yum reinstall –downloadonly –downloaddir=/home/bob package-1.3-7

          but if you want to download a copy of a package older then you have then

          yum downgrade –downloadonly –downloaddir=/home/bob package-1.3-1

      • John Mar 11, 2013 @ 16:08

        Thanks Golda,

        Your tip saved me a huge headache just now :)

  • venugopal Mar 12, 2009 @ 7:42

    i want to install qmail in rhel5

  • Devin Mar 19, 2009 @ 22:37

    use the –installroot option for yum to download already-installed packages.

    It’ll download all the package’s dependencies to that location, but at least you’ll have the rpm you wanted.

    so do:
    yum install –downloadonly –downloaddir=/tmp/ –installroot=/tmp

    *edit* posted with wrong e-mail

  • ashwani Jul 8, 2009 @ 13:55

    but this doesnt work on yum groupinstall it gives error

  • sjoshi Oct 8, 2009 @ 19:04

    So, after it has been downloaded, I will try to take that package to another machine without internet connect and install from the downloaded package. What command would I run to install it from the downloaded package and not using internet connection?
    If yum can’t do it, could anybody provide a another command or so..

  • dan Oct 21, 2009 @ 14:51

    This works great – thanks for the tip !

  • milek Nov 4, 2009 @ 21:46

    Or just use:
    yumdownloader [package]
    to download file in current dir
    yumdownloader is part of yum-utils package:
    yum install yum-utils

  • James Feb 17, 2010 @ 14:21

    great milek! thats just what i was looking for, thanks!

  • 🐧 nixCraft Mar 9, 2010 @ 5:54

    @ milek,

    Thanks for the heads up. The faq has been updated.

  • Hari Apr 21, 2010 @ 2:28

    Thank you so much for this guide, it helped me to download R-core and about 15 of its missing dependencies that I needed in a single shot for a later install.

  • poboy Dec 7, 2010 @ 9:06

    thanks very much!

  • Raju Hasan May 25, 2011 @ 0:44

    How do i download mediaplayer for Redhat 5 with windows moode?

  • Pioup Aug 16, 2011 @ 19:45

    And how I can download “yum-downloadonly-plugin” without install it ????
    This is the big lack I can’t stand on “Yum” distros! How I can do my scripts post-installation with a such lack?
    This package is not heavy, so why isn’t not installed in standard?

  • Jayaram Prasad Aug 20, 2011 @ 17:59


    Its great tool….I did the following steps to download CPP rpms

    yum install yum-downloadonly

    yumdownloader gcc


  • Jake Aug 24, 2011 @ 16:53

    New to CENTOS & Yum, looking for the best way to download Splunk to our brand new server setup …. yum install is the command, but how do I get the Splunk download package to where I can install it?

  • Sandy Sep 21, 2011 @ 13:27

    We have RHN subsciption and successfully downloaded updates available to the specified destination directory.

    I copied these downloaded files to RHEL5.5 machine.(which can not be kept under network due to security reasons)
    Now, I need to do offline install/update of the downloaded packages on this machine.But failed to do this. Any suggestions ?
    I used “yum localupdate *” command to perform this operation.

    One strange fact is, yum localupdate command is resolving dependancies when connected to RHN. But, on a offline machine even though I have copied all dependant packages it is not resolving dependencies(For Ex., to update an already installed package it is unable to install a new package available in the same directory).

    Any help is appreciated.


  • jayaram Prasad Sep 22, 2011 @ 3:22

    Then why cant you prepare a shellscript by including all the packages to be installed at once by giving the location too…
    I mean we could try like rpm -Uvh some-thing.rpm
    to install use just rpm -ivh some-thing.rpm
    make this like a shell script and install them…

  • Sandy Sep 25, 2011 @ 16:27

    Jai Thanks for the reply.

    I understand that “rpm -Uvh” can update installed packages but it can not resolve dependencies on its own. Ok, let me put my question this way,
    why “yum localupdate * ” command on RHN connected machine is resolving dependencies on its own ? and why not the same command on an offline machine can not resolve all dependencies though all dependent packages are in the same local directory ?
    My intention here is, do not resolve any dependency issues manually on an offline machine. localupdate by name it should behave similar on a RHN connected machine as well as on an offline machine.

    Correct me if I am missing anything during packaging and extracting on an offline machine.
    I downloaded all updates using ” yum update -y –downloadonly –downloaddir=/tmp ” and copied all these files to offline machine and ran “yum localupdate * ” command.


  • Sandy Sep 25, 2011 @ 16:40

    One more quick point, I am allowed to use/setup any yum repositories to achieve these automated updates of RPMs installed on a offline machine.

  • Sandy Oct 20, 2011 @ 12:48

    Yeah.. I figured it out myself. I followed the below sequense to install downloaded RPM updates on a offline machine.

    First downloaded RPM updates on a RHN registered machine in the following way,
    1) yum install yum-downloadonly // installed yum download only plugin
    //Downloaded availbale RPM updates to the /root/RPM_Updates/downloads directory
    2) yum update -y –downloadonly –downloaddir=/root/RPM_Updates/downloads
    3) Packaged these downloads into a tar file and transferred them to the offline machine.

    On a offline machine, I created a local repository of downloaded RPMs and installed them using yum update command. in the following way,
    1) Untar’ed RPM updates to the “/root/RPM_Updates/downloads” directory
    2) Created rhel_local.repo file with the following content and copied it into /etc/yum.repos.d directory,

    name=rhel-local $releaseserver $basearch – rhel-local

    3) Installed createrepo rpm using Yum localinstall command.
    yum localinstall createrepo-0.4.11-3.el5.noarch.rpm # Before executing this command, This RPM was downloaded from the RHN connected machine and copied to this offline machine.
    4) createrepo /root/RPM_Updates/downloads # Created local repository with this command.
    5) Yum update -y # Hurrah I succefully installed RPM updates now from the local repository with out any need of registering the machine with RHN. Ofcourse, I downloded these updated RPMs from the official RHN registered machine :)

    • Chuck Ho Apr 2, 2013 @ 20:15

      Thanx Sandy!! Everything work exactly like the way you posted!

  • Glauco Furlaneto Nov 3, 2011 @ 9:48

    Excelent article, Vivek Gite.

  • Rodger Nov 29, 2011 @ 19:46


    My system:
    Oracle Redhat 5.5

    cat /proc/version
    Linux version 2.6.18-194.el5xen (mockbuild@ca-build10.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Mon Mar 29 22:22:00 EDT 2010

    I’m trying to get yum to work.
    I tried your command.

    yum -v install yum-downloadonly

    Loading “security” plugin
    Config time: 0.040
    Yum Version: 3.2.22
    Setting up Package Sacks
    rpmdb time: 0.000
    Setting up Install Process
    Setting up Package Sacks
    Checking for virtual provide or file-provide for yum-downloadonly
    Searching pkgSack for dep: yum-downloadonly
    Setting up Package Sacks
    No package yum-downloadonly available.
    Setting up Package Sacks
    Nothing to do

    Is there some kind of configuration I need to do first?

    If so, what is a link explaining this?

    Thanks a lot!

  • Martin Allert Mar 28, 2012 @ 17:17

    Use the yumdownloader, Luke! :) You need to install the yum-tools first….

  • badal jain Apr 13, 2012 @ 6:24

    how can i copy the packages of the media on rhel -5..
    please give complete steps.

  • alireza seighalani Dec 15, 2012 @ 21:41

    youre article is amazing. thanks man ;)

  • joe Feb 1, 2013 @ 13:56


    How do you also get the dependencies as well?

    I went from rhel 5.4 to 5.6 and now the yum errors out.

    Thanks, Joe

  • brian Apr 10, 2013 @ 16:12

    I hate to burst your bubble, but according to testout.com, the answer was yumdownloader. they’re a company that prepares you for your A+ certification, and I would double-check the answer you’re saying it is.

  • Lefeuvre Oct 24, 2014 @ 14:34


    We would like to xpdf on LINUX RH 6. The .rpm file is only 1.7MB and since we do not have access to Internet on our server when we execute the .rpm file it does not download the dependencies.

    How can i download the dependencies and the entire package when i don’t have access to Internet?

    Shall i use YUM?

    Best regards

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum