• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to use “yum downloadonly” to download a package without installing it

by admin

Ther are multiple ways in which you can download a yum package without installing it. The 2 most commonly used methods are described here in the post.
1. using the “downloadonly” plugin for yum
2. using “yumdownloader” utility.

Method 1 : using the “downloadonly” plugin for yum

1. Install the package including “downloadonly” plugin:

# yum install yum-plugin-downloadonly

2. Run yum command with “–downloadonly” option as follows:

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

For example to download the package for firefox without actually installing it, use the command shown below:

# yum install --downloadonly --downloaddir=/tmp firefox

yum downloadonly - download yum packages without installing them

The firefox package gets downloded into the specified /tmp directory. Confirm the RPM files are available in the specified download directory.

# ls -lrt /tmp/firefox-52.5.0-1.el7.centos.x86_64.rpm 
-rw-r--r--. 1 root root 87273716 Nov 17 16:21 /tmp/firefox-52.5.0-1.el7.centos.x86_64.rpm
Note: If you do not specify the –downloaddir option, the files are saved by default in /var/cache/yum/ in rhel-{arch}-channel/packages

3. You can also download multiple packages at the same time using the downloadonly plugin. For example to download packages for firefox and mutt at the same time, use the command below :

# yum install --downloadonly --downloaddir=/tmp firefox mutt
Note: If only the package name is specified, the latest available package is downloaded (such as sshd). Otherwise, you can specify the full package name and version (such as mutt-1.5.21-27.el7.x86_64).

Method 2 : using the “yumdownloader” utility

The “yumdownloader” command is particularly useful when you want to download a package which is already installed on your system.

1. Install the yum-utils package:

# yum install yum-utils

2. Run the command followed by the desired package.

# yumdownloader [package]

For example to download a package for mutt which is already installed on the system, use the below command.

# yumdownloader mutt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.vcu.edu
 * epel: mirror.us.leaseweb.net
 * extras: mirror.lug.udel.edu
 * nux-dextop: li.nux.ro
 * updates: mirror.wdc1.us.leaseweb.net
mutt-1.5.21-27.el7.x86_64.rpm                 | 1.4 MB  00:00:00

3. You would find the latest mutt package downloaded in the current working diretory.

# ls -lrt mutt-1.5.21-27.el7.x86_64.rpm 
-rw-r--r--. 1 root root 1444476 Aug 10 18:21 mutt-1.5.21-27.el7.x86_64.rpm

You can also specify a download directory to download the package. For example,

# yumdownloader --destdir=/var/tmp mutt
Note: Be sure to add –resolve to the yumdownloader utility, if you need to download dependencies.

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to activate and mount 2 Volume groups with same names in CentOS/RHEL
  2. ipcs Command Examples in Linux
  3. ‘nestat -s’ showing a large number for “packet reassembles failed” errors in CentOS/RHEL
  4. What are Reserved User Accounts in MySQL
  5. ping Command Examples in Linux
  6. chcon command examples in Linux
  7. How to install/get packages from Oracle EPEL Repository on OEL 7
  8. How To Create A SSH Banner in CentOS/RHEL Server
  9. How to Lock and Unlock Zimbra Accounts from Command Line
  10. mdadm Command Shows State : active, degraded

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright