Dec 25, 2012

How to use yum to download RPM packages without installing them


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:



--downloadonly : don't update, just download a rpm file
--downloaddir=/path/to/dir : specifies an alternate directory to store packages such as /tmp


So, please confirm package yum-downloadonly has been installed on the system.


[root@localhost ~]# yum install yum-downloadonly

Now, pass the option --downloaddir with --downloadonly to yum, to specify an alternate directory to store packages:

The newest version of oracle-validated-verify, if there is and not installed in system, would be downloaded in folder /home/source

Downloading a package already installed

To download a package that have been installed, please use yumdownloader instead. For example, httpd-2.2.3-22.el5 is installed in system:

[root@localhost ~]# rpm -q httpd
httpd-2.2.3-22.el5


And download that package with yumdownloader:

[root@localhost ~]# yumdownloader httpd-2.2.3-22.el5
 
Loaded plugins: fastestmirror, kmod, protectbase, rhnplugin, versionlock
Loading mirror speeds from cached hostfile
Reading version lock configuration
0 packages excluded due to repository protections
httpd-2.2.3-22.el5.i386.rpm


That downloaded package is saved in current directory.  Option --destdir can be used to specify a destination directory for the download. man yumdownloader for more details.

How to download all dependencies for one RPM

In this example we will download all RPMs and dependencies for kmod-oracleasm in /home/source directory so we can use them on all other machines later.

[root@localhost]# yum --downloadonly --downloaddir=/home/source -y install oracle-rdbms-server-12cR1-preinstall

[root@localhost source]# yum --downloadonly --downloaddir=/home/source -y install oracle-rdbms-server-12cR1-preinstall                                                  Loaded plugins: downloadonly, product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-11.el6 will be installed
--> Processing Dependency: gcc for package: oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64
--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64
--> Processing Dependency: kernel-uek for package: oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64
--> Processing Dependency: libaio-devel for package: oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64
--> Processing Dependency: glibc-devel for package: oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-4.el6 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-4.el6 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: libgcc >= 4.4.7-4.el6 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-4.el6.x86_64
---> Package gcc-c++.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: libstdc++ = 4.4.7-4.el6 for package: gcc-c++-4.4.7-4.el6.x86_64
--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-4.el6.x86_64
---> Package glibc-devel.x86_64 0:2.12-1.132.el6 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.132.el6 for package: glibc-devel-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-devel-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.132.el6.x86_64
---> Package kernel-uek.x86_64 0:2.6.39-400.214.5.el6uek will be installed
--> Processing Dependency: kernel-uek-firmware = 2.6.39-400.214.5.el6uek for package: kernel-uek-2.6.39-400.214.5.el6uek.x86_64
--> Processing Dependency: dracut-kernel >= 004-242.0.3 for package: kernel-uek-2.6.39-400.214.5.el6uek.x86_64
---> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed
---> Package libstdc++-devel.x86_64 0:4.4.7-4.el6 will be installed
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-4.el6 will be installed
---> Package dracut-kernel.noarch 0:004-53.el6 will be updated
---> Package dracut-kernel.noarch 0:004-336.0.1.el6_5.2 will be an update
--> Processing Dependency: dracut = 004-336.0.1.el6_5.2 for package: dracut-kernel-004-336.0.1.el6_5.2.noarch
---> Package glibc.i686 0:2.12-1.25.el6 will be updated
--> Processing Dependency: glibc = 2.12-1.25.el6 for package: glibc-common-2.12-1.25.el6.x86_64
---> Package glibc.x86_64 0:2.12-1.25.el6 will be updated
---> Package glibc.i686 0:2.12-1.132.el6 will be an update
---> Package glibc.x86_64 0:2.12-1.132.el6 will be an update
---> Package glibc-headers.x86_64 0:2.12-1.132.el6 will be installed
---> Package kernel-uek-firmware.noarch 0:2.6.39-400.214.5.el6uek will be installed
---> Package libgcc.i686 0:4.4.5-6.el6 will be updated
---> Package libgcc.x86_64 0:4.4.5-6.el6 will be updated
---> Package libgcc.i686 0:4.4.7-4.el6 will be an update
---> Package libgcc.x86_64 0:4.4.7-4.el6 will be an update
---> Package libgomp.x86_64 0:4.4.5-6.el6 will be updated
---> Package libgomp.x86_64 0:4.4.7-4.el6 will be an update
---> Package libstdc++.x86_64 0:4.4.5-6.el6 will be updated
---> Package libstdc++.x86_64 0:4.4.7-4.el6 will be an update
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
--> Running transaction check
---> Package dracut.noarch 0:004-53.el6 will be updated
---> Package dracut.noarch 0:004-336.0.1.el6_5.2 will be an update
---> Package glibc-common.x86_64 0:2.12-1.25.el6 will be updated
---> Package glibc-common.x86_64 0:2.12-1.132.el6 will be an update
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Processing Conflict: kernel-uek-2.6.39-400.214.5.el6uek.x86_64 conflicts device-mapper-multipath < 0.4.9-64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package device-mapper-multipath.x86_64 0:0.4.9-41.el6 will be updated
---> Package device-mapper-multipath.x86_64 0:0.4.9-72.0.1.el6_5.1 will be an update
--> Processing Dependency: kpartx = 0.4.9-72.0.1.el6_5.1 for package: device-mapper-multipath-0.4.9-72.0.1.el6_5.1.x86_64
--> Processing Dependency: device-mapper-multipath-libs = 0.4.9-72.0.1.el6_5.1 for package: device-mapper-multipath-0.4.9-72.0.1.el6_5.1.x86_64
--> Processing Dependency: libmpathpersist.so.0()(64bit) for package: device-mapper-multipath-0.4.9-72.0.1.el6_5.1.x86_64
--> Running transaction check
---> Package device-mapper-multipath-libs.x86_64 0:0.4.9-41.el6 will be updated
---> Package device-mapper-multipath-libs.x86_64 0:0.4.9-72.0.1.el6_5.1 will be an update
---> Package kpartx.x86_64 0:0.4.9-41.el6 will be updated
---> Package kpartx.x86_64 0:0.4.9-72.0.1.el6_5.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                                 Arch                      Version                                      Repository                         Size
========================================================================================================================================================================
Installing:
 oracle-rdbms-server-12cR1-preinstall                    x86_64                    1.0-11.el6                                   ol6_latest                         15 k
Updating:
 device-mapper-multipath                                 x86_64                    0.4.9-72.0.1.el6_5.1                         ol6_latest                        117 k
Installing for dependencies:
 cloog-ppl                                               x86_64                    0.15.7-1.2.el6                               ol6_latest                         93 k
 cpp                                                     x86_64                    4.4.7-4.el6                                  ol6_latest                        3.7 M
 gcc                                                     x86_64                    4.4.7-4.el6                                  ol6_latest                         10 M
 gcc-c++                                                 x86_64                    4.4.7-4.el6                                  ol6_latest                        4.7 M
 glibc-devel                                             x86_64                    2.12-1.132.el6                               ol6_latest                        977 k
 glibc-headers                                           x86_64                    2.12-1.132.el6                               ol6_latest                        608 k
 kernel-uek                                              x86_64                    2.6.39-400.214.5.el6uek                      ol6_UEK_latest                     28 M
 kernel-uek-firmware                                     noarch                    2.6.39-400.214.5.el6uek                      ol6_UEK_latest                    3.6 M
 libaio-devel                                            x86_64                    0.3.107-10.el6                               ol6_latest                         13 k
 libstdc++-devel                                         x86_64                    4.4.7-4.el6                                  ol6_latest                        1.6 M
 mpfr                                                    x86_64                    2.4.1-6.el6                                  ol6_latest                        156 k
 ppl                                                     x86_64                    0.10.2-11.el6                                ol6_latest                        1.3 M
Updating for dependencies:
 device-mapper-multipath-libs                            x86_64                    0.4.9-72.0.1.el6_5.1                         ol6_latest                        181 k
 dracut                                                  noarch                    004-336.0.1.el6_5.2                          ol6_latest                        122 k
 dracut-kernel                                           noarch                    004-336.0.1.el6_5.2                          ol6_latest                         24 k
 glibc                                                   i686                      2.12-1.132.el6                               ol6_latest                        4.3 M
 glibc                                                   x86_64                    2.12-1.132.el6                               ol6_latest                        3.8 M
 glibc-common                                            x86_64                    2.12-1.132.el6                               ol6_latest                         14 M
 kpartx                                                  x86_64                    0.4.9-72.0.1.el6_5.1                         ol6_latest                         58 k
 libgcc                                                  i686                      4.4.7-4.el6                                  ol6_latest                        112 k
 libgcc                                                  x86_64                    4.4.7-4.el6                                  ol6_latest                        100 k
 libgomp                                                 x86_64                    4.4.7-4.el6                                  ol6_latest                        118 k
 libstdc++                                               x86_64                    4.4.7-4.el6                                  ol6_latest                        292 k

Transaction Summary
========================================================================================================================================================================
Install      13 Package(s)
Upgrade      12 Package(s)

Total download size: 79 M
Downloading Packages:
(1/25): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm                                                                                                      |  93 kB     00:01
(2/25): cpp-4.4.7-4.el6.x86_64.rpm                                                                                                               | 3.7 MB     01:13
(3/25): device-mapper-multipath-0.4.9-72.0.1.el6_5.1.x86_64.rpm                                                                                  | 117 kB     00:04
(4/25): device-mapper-multipath-libs-0.4.9-72.0.1.el6_5.1.x86_64.rpm                                                                             | 181 kB     00:01
(5/25): dracut-004-336.0.1.el6_5.2.noarch.rpm                                                                                                    | 122 kB     00:00
(6/25): dracut-kernel-004-336.0.1.el6_5.2.noarch.rpm                                                                                             |  24 kB     00:01
(7/25): gcc-4.4.7-4.el6.x86_64.rpm                                                                                                               |  10 MB     02:34
(8/25): gcc-c++-4.4.7-4.el6.x86_64.rpm                                                                                                           | 4.7 MB     00:36
(9/25): glibc-2.12-1.132.el6.i686.rpm                                                                                                            | 4.3 MB     00:29
(10/25): glibc-2.12-1.132.el6.x86_64.rpm                                                                                                         | 3.8 MB     01:25
(11/25): glibc-common-2.12-1.132.el6.x86_64.rpm                                                                                                  |  14 MB     03:29
(12/25): glibc-devel-2.12-1.132.el6.x86_64.rpm                                                                                                   | 977 kB     00:07
(13/25): glibc-headers-2.12-1.132.el6.x86_64.rpm                                                                                                 | 608 kB     00:04
(14/25): kernel-uek-2.6.39-400.214.5.el6uek.x86_64.rpm                                                                                           |  28 MB     03:02
(15/25): kernel-uek-firmware-2.6.39-400.214.5.el6uek.noarch.rpm                                                                                  | 3.6 MB     01:05
(16/25): kpartx-0.4.9-72.0.1.el6_5.1.x86_64.rpm                                                                                                  |  58 kB     00:00
(17/25): libaio-devel-0.3.107-10.el6.x86_64.rpm                                                                                                  |  13 kB     00:00
(18/25): libgcc-4.4.7-4.el6.i686.rpm                                                                                                             | 112 kB     00:17
(19/25): libgcc-4.4.7-4.el6.x86_64.rpm                                                                                                           | 100 kB     00:00
(20/25): libgomp-4.4.7-4.el6.x86_64.rpm                                                                                                          | 118 kB     00:03
(21/25): libstdc++-4.4.7-4.el6.x86_64.rpm                                                                                                        | 292 kB     00:18
(22/25): libstdc++-devel-4.4.7-4.el6.x86_64.rpm                                                                                                  | 1.6 MB     00:13
(23/25): mpfr-2.4.1-6.el6.x86_64.rpm                                                                                                             | 156 kB     00:00
(24/25): oracle-rdbms-server-12cR1-preinstall-1.0-11.el6.x86_64.rpm                                                                              |  15 kB     00:00
(25/25): ppl-0.10.2-11.el6.x86_64.rpm                                                                                                            | 1.3 MB     00:07
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    86 kB/s |  79 MB     15:39


exiting because --downloadonly specified
[root@localhost source]#



As you can see yum just downloaded whole RPMs without instaling them, it says above :

exiting because --downloadonly specified  

What we may do now is just copy all those RPMs to other machines or systems (which do not have access to internet repository) and install them, simply getting into directory with RPMs and running this command :

[root@localhost]# yum install * 

Post a Comment

 
TECH SUPPORT © 2012-2016