In this tutorial, we are going to discuss how we can use yum to download packages without installing it on our server. I recently discovered this option & thought that I share it 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 manager 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

The process for both is different, so let's start with it.

Recommended Read: How do i install RPM packages on Ubuntu ???

Also Read: Install Python PIP: A python package manager


1- Using 'yumdownloader'

If we need to download an installed package, then 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 packages 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, we now end our tutorial on how to download packages without installing them. 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 :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money: [paypal-donation]

Linux TechLab is thankful for your continued support.