How To Download a RPM Package Using yum Command Without Installing On Linux

by on July 9, 2008 · 39 comments· LAST UPDATED March 9, 2010

in , ,

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:
 * updates:
 * addons:
 * extras:
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:
 * updates:
 * addons:
 * extras:
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

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 39 comments… read them below or add one }

1 Grrruk October 6, 2008 at 8:40 am

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…


2 Nick Webb November 21, 2011 at 1:51 am

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


3 nixCraft October 6, 2008 at 1:14 pm


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


4 LAMP setup: Beginning | December 5, 2008 at 12:54 pm

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!


5 ashu January 17, 2009 at 12:34 pm

Jai Hind

Thanks vivek for this very cool and useful trick


6 Arun Kumar February 26, 2009 at 5:34 pm

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?


7 keLz March 7, 2009 at 8:34 am

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


8 Golda October 29, 2010 at 12:54 pm

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


9 asdf@asdf.tld April 19, 2011 at 1:31 pm

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.



10 asdf@asdf.tld April 19, 2011 at 1:36 pm


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


11 John March 11, 2013 at 4:08 pm

Thanks Golda,

Your tip saved me a huge headache just now :)


12 venugopal March 12, 2009 at 7:42 am

i want to install qmail in rhel5


13 Devin March 19, 2009 at 10:37 pm

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


14 ashwani July 8, 2009 at 1:55 pm

but this doesnt work on yum groupinstall it gives error


15 sjoshi October 8, 2009 at 7:04 pm

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


16 dan October 21, 2009 at 2:51 pm

This works great – thanks for the tip !


17 milek November 4, 2009 at 9:46 pm

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


18 James February 17, 2010 at 2:21 pm

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


19 nixCraft March 9, 2010 at 5:54 am

@ milek,

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


20 Hari April 21, 2010 at 2:28 am

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.


21 poboy December 7, 2010 at 9:06 am

thanks very much!


22 Raju Hasan May 25, 2011 at 12:44 am

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


23 Pioup August 16, 2011 at 7:45 pm

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?


24 Jayaram Prasad August 20, 2011 at 5:59 pm


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

yum install yum-downloadonly

yumdownloader gcc



25 Jake August 24, 2011 at 4:53 pm

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?


26 Sandy September 21, 2011 at 1:27 pm

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.



27 jayaram Prasad September 22, 2011 at 3:22 am

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…


28 Sandy September 25, 2011 at 4:27 pm

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.



29 Sandy September 25, 2011 at 4:40 pm

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.


30 Sandy October 20, 2011 at 12:48 pm

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


31 Chuck Ho April 2, 2013 at 8:15 pm

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


32 Glauco Furlaneto November 3, 2011 at 9:48 am

Excelent article, Vivek Gite.


33 Rodger November 29, 2011 at 7:46 pm


My system:
Oracle Redhat 5.5

cat /proc/version
Linux version 2.6.18-194.el5xen ( (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!


34 Martin Allert March 28, 2012 at 5:17 pm

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


35 badal jain April 13, 2012 at 6:24 am

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


36 alireza seighalani December 15, 2012 at 9:41 pm

youre article is amazing. thanks man ;)


37 joe February 1, 2013 at 1:56 pm


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


38 brian April 10, 2013 at 4:12 pm

I hate to burst your bubble, but according to, 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.


39 Lefeuvre October 24, 2014 at 2:34 pm


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 Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: