Downloading a Specific Version of Package and Its Dependencies from Repository for Offline Installation Using YUM

Question : How to download a specific version of the package along with its dependencies using YUM offline.

Answer :
1. To see what particular versions are available to you via yum you can use the –showduplicates switch.

# yum --showduplicates list [package_name]

For Example :

# yum --showduplicates list httpd
Loaded plugins: product-id, security, subscription-manager.
Installed Packages
httpd.x86_64 2.2.15-39.0.1.el6 @ol6_x86_64_latest         --- installed
Available Packages
httpd.x86_64 2.2.15-5.0.1.el6 ol6_x86_64_latest           --- older versions
httpd.x86_64 2.2.15-9.0.1.el6 ol6_x86_64_latest
....

2. If there is a need to download the older version package along with its dependencies for an off-line installation, you can use one of the following options to download a particular version of RPM from the web, and then use yum to install it.

Method 1

To download the packages into a local directory, use – -downloaddir=[dir] option along with the –downloadonly switch of yum command.

# yum install --downloadonly --downloaddir=[directory] [package]

For example :

# yum install --downloadonly --downloaddir=/tmp/ httpd.x86_64 2.2.15-5.0.1.el6

Method 2

To download package with its dependencies using yumdownloader :

# yumdownloader [package]

To download the package to a local folder try the option “- -destdir=DESTDIR”

# yumdownloader --destdir=[DIR] [package]

For example :

# yumdownloader --destdir=/tmp httpd.x86_64 2.2.15-5.0.1.el6

To download the packe along with all dependencies, use option “- -resolve” along with “- -destdir”

# yumdownloader --destdir=[DIR] --resolve [package]

Installing packages locally

Now install the packages from the local directory with yum command option “localinstall”

# yum localinstall [path to rpm]
Related Post