• 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. gsettings: command not found
  2. How to check rpm package integrity in Linux
  3. CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  4. cpio Command Examples in Linux
  5. autorandr Command Examples in Linux
  6. genkernel Command Examples in Linux
  7. 5 Useful Command Examples to Monitor User Activity under Linux
  8. Comparing NET-TOOLS V/s IPROUTE Package Commands (ip Vs ifconfig command comparison)
  9. How To Create a Local Yum Repository for MySQL Enterprise Packages
  10. How to Calculate Memory Usage in Linux using sar, ps, and free

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright