Centos yum only download package Not Installed

Source: Internet
Author: User

Centos yum only download package Not Installed

Yum is the default Package Manager based on Red Hat systems (such as CentOS, Fedora, and RHEl. With yum, you can install or update an RPM package, and it automatically resolves the package dependency. But what if you only want to download an RPM package to your system? For example, you may want to get some RPM packages for later use or install them on another machine.

The following explains how to download an RPM package from the yum repository.
Method 1: yum

The yum command itself can be used to download an RPM package. The standard yum command provides the-downloadonly option to achieve this purpose.

$ sudo yum install --downloadonly <package-name>

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

/var/cache/yum/x86_64/[centos/fedora-version]/[repository]/packages

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

If you want to download a package to a specified directory (such as/tmp ):

$ sudo yum install --downloadonly --downloaddir=/tmp <package-name>

Note: If the downloaded package contains any dependency that is not met, yum will download all dependency packages, but will not be installed.

Another important thing is that in CentOS/RHEL 6 or later versions, you need to install a separate yum plug-in (named yum-plugin-downloadonly) to use the-downloadonly Command Option:

$ sudo yum install yum-plugin-downloadonly

If this plug-in is not available, you will get the following error when using yum:

Command line error: no such option: --downloadonly 201568175145007.jpg (800×459)
Method 2: Yumdownloader

Another method for downloading the RPM package is to download the package through yumdownloader. This tool is a subset of the yum Toolkit (including the help toolkit for yum package management.

$ sudo yum install yum-utils

Download an RPM package:

$ sudo yumdownloader <package-name>

The downloaded package is saved in the current directory. You need to use the root permission, because yumdownloader will update the package index file during the download process. Unlike the yum command, no dependent package will be downloaded.

Related Article

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.