To download the RPM package in CentOS with the Yum command, but not install the method

Source: Internet
Author: User
Tags centos

Yum is the default package Manager on Red Hat based systems such as CentOS, Fedora, and RHEl. With yum, you can install or update an RPM package, and he will automatically resolve the package dependencies. But what if you just want to download an RPM package to your system? For example, you might want to get some RPM packages to use later, or install them on another machine.

This explains how to download an RPM package from the Yum warehouse.

Method One: Yum

The Yum command itself can be used to download an RPM package, and the standard Yum command provides a--downloadonly (download only) option to achieve this goal.

The code is as follows:

$ sudo yum install--downloadonly

By default, a downloaded RPM package is saved in the following directory:

The code is as follows:


The [repository] above indicates the name of the source repository for the download package (for example, base, fedora, updates)

If you want to download a package to a specified directory (for example,/tmp):

The code is as follows:

$ sudo yum install--downloadonly--downloaddir=/tmp

Note that if the downloaded package contains any dependencies that are not satisfied, Yum will download all the dependency packages, but will not be installed.

Another important thing is that in Centos/rhel 6 or earlier versions, you need to install a separate Yum plug-in (named Yum-plugin-downloadonly) to use the--downloadonly command option:

The code is as follows:

$ sudo yum install yum-plugin-downloadonly

If you do not have the plugin, you will get the following error when using Yum:

The code is as follows:

Command line error:no such option:--downloadonly

Method Two: Yumdownloader

Another way to download the RPM package is through a dedicated package download tool--yumdownloader. This tool is a subset of the Yum Toolkit (which contains a help kit for Yum package management).

The code is as follows:

$ sudo yum install yum-utils

Download an RPM Package:

The code is as follows:

$ sudo yumdownloader

The downloaded package is saved in the current directory. You need to use root permissions because Yumdownloader will update the package index files during the download process. Unlike the Yum command, any dependency pack is not downloaded.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.