Quick way to download rpm package. This method will only download rpm package only without installing it on the system.
Download rpm package
Basically there are two methods to download rpm package without installing|installation.
1. Download rpm package using “downloadonly” option for YUM
Steps:
- Before proceeding you must check that “download only” package is installed or not.
# rpm -qa|grep -i yum-plugin-downloadonly
If it’s giving blank output that means it’s not installed ,then install it using below command.
[root@rhel1 ~]# yum install yum-plugin-downloadonly Loaded plugins: product-id, security, subscription-manager Updating certificate-based repositories. server | 1.9 kB 00:00 ... Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-plugin-downloadonly.noarch 0:1.1.30-10.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: yum-plugin-downloadonly noarch 1.1.30-10.el6 server 19 k Transaction Summary ================================================================================ Install 1 Package(s) Total download size: 19 k Installed size: 21 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : yum-plugin-downloadonly-1.1.30-10.el6.noarch 1/1 Installed products updated. Installed: yum-plugin-downloadonly.noarch 0:1.1.30-10.el6 Complete!
Note for RHEL 5 Use below command:
# yum install yum-downloadonly
- Now use yum command along with “–downloadonly” option as below:
# yum install --downloadonly --downloaddir=<directory_location> <package name>
Let’s say you want to download rpm package for “vi editor”without installing then give below command:
# yum install --downloadonly --downloaddir=/tmp/mann vi Loaded plugins: amazon-id, rhui-lb, search-disabled-repos Resolving Dependencies --> Running transaction check ---> Package vim-minimal.x86_64 2:7.4.160-1.el7 will be updated ---> Package vim-minimal.x86_64 2:7.4.160-1.el7_3.1 will be an update --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Updating: vim-minimal x86_64 2:7.4.160-1.el7_3.1 rhui-REGION-rhel-server-releases 436 k Transaction Summary ======================================================================================================================================================================== Upgrade 1 Package Total download size: 436 k Background downloading packages, then exiting: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. vim-minimal-7.4.160-1.el7_3.1.x86_64.rpm | 436 kB 00:00:00 exiting because "Download Only" specified
Now if go to location /tmp/mann you will find downloaded rpm package for vi editor as below:
#cd /tmp/mann # ll total 444 -rw-r--r--. 1 root root 446692 Dec 21 04:44 vim-minimal-7.4.160-1.el7_3.1.x86_64.rpm # pwd /tmp/mann
2. Download rpm package using Yumdownloader
Steps:
- You must check yum-utils package before proceeding using rpm command as below:
[root@rhel1 mann]# rpm -qa|grep yum-utils yum-utils-1.1.30-10.el6.noarch [root@rhel1 mann]#
If the command is giving blank output that means you must install the same using command below:
[root@rhel1 mann]# yum install yum-utils Loaded plugins: downloadonly, product-id, security, subscription-manager Updating certificate-based repositories. Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0:1.1.30-10.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: yum-utils noarch 1.1.30-10.el6 server 94 k Transaction Summary ======================================================================================================================================================================== Install 1 Package(s) Total download size: 94 k Installed size: 286 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : yum-utils-1.1.30-10.el6.noarch 1/1 Installed products updated. Installed: yum-utils.noarch 0:1.1.30-10.el6 Complete! [root@rhel1]#
- Once you are done with yum-utlils give yumdownloader as below
yumdownloader <package name>
Let’s say you want to download rpm package for famous vi editor then:
[root@rhel1]# pwd /root [root@rhel1]# yumdownloader vi Loaded plugins: amazon-id, rhui-lb vim-minimal-7.4.160-1.el7_3.1.x86_64.rpm | 436 kB 00:00:00 [root@rhel1]# ll total 452 -rw-------. 1 root root 7548 Mar 1 2016 anaconda-ks.cfg -rw-r--r--. 1 root root 446692 Dec 21 04:44 vim-minimal-7.4.160-1.el7_3.1.x86_64.rpm [root@rhel1]#
The above command will download rpm package in the current directory to specify download rpm package directory you must use “–destdir” option as below:
[root@rhel1]# yumdownloader --destdir=/tmp/mann vi Loaded plugins: amazon-id, rhui-lb vim-minimal-7.4.160-1.el7_3.1.x86_64.rpm | 436 kB 00:00:00 [root@rhel1]# cd /tmp/mann/ [root@rhel1 mann]# ll total 444 -rw-r--r--. 1 root root 446692 Dec 21 04:44 vim-minimal-7.4.160-1.el7_3.1.x86_64.rpm [root@rhel1 mann]#
View Comments (1)
I don't follow the step 2. I thought you would show how to download but not installed the rpms. I have an air gapped system to which I can apply this technique on a internet accessible system. Step 1 was detailed but step 2 doesn't seem to follow from step 1.