Using yum to download packages without installing them

In this tutorial, we are going to discuss about how we can use yum to download packages without actually installing it on our server. I recently discovered this option & thought that I share with all of you guys. But before we actually discuss the option let’s talk in brief about yum.

Yum aka Yellowdog Updater Modified, is the default packet manger for RHEL\CentOS. It has a number of options that can be used to with it to fetch information, install or uninstall the packages. We have discussed quite a few options in our article WORKING WITH YUM (with examples) , so please read it to get to know yum in a detail.

Now let’s start with the main part of the tutorial i.e. how we can yum to download packages without installing/updating it on our server. There are two methods to do this,

1- Using ‘yumdownloader’

2- Using ‘downloadonly’ plugin

Process for both is different, so let’s start with it.

1- Using ‘yumdownloader’

If we need to download an installed package, than we first need to install ‘yumdownloader’ on our system. Yumdownloader is part of ‘yum-utils’ package,

$ sudo yum install yum-utils

After the package has been installed, we can now use yumdownloader to download the required package,

$ sudo yumdownloader httpd

The downloaded package will be available in the same directory that the command was executed.

2- Using ‘downloadonly’ plugin with yum

To use ‘downloadonly’ plugin with yum, we will firstly install the plugin using yum,

$ sudo yum install yum-downloadonly

Now after installing the plugin, execute the following command to download the required package,

$ sudo yum install –downloadonly –downloaddir=/root/Desktop httpd

We can change the location of download directory to something else as well but if we will not provide the ‘downloaddir’ option , then downloaded files will be sent to ‘/var/cache/yum/ in rhel-{arch}-channel/packages’ directory. Also we can download multiple packges in single command.

To download a specified version of the package, mention the full package name like ‘httpd-2.2.15-60.el6.centos.5.x86_64.rpm’.

That’s it guys, please do mention your questions or suggestions using the comment box below.

ADIOS !!!

If you think we have helped you or just want to support us, please consider these :-