Download RPM Package in Cenos

Source: Internet
Author: User

In the implementation of the deployment, often the server environment has no extranet or access to foreign web sites. This is an RPM that can be downloaded in the CentOS environment of the native virtual machine.

Method One: Yum

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

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 where the package was downloaded (for example: base, fedora, updates)

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

Yum Install--downloadonly--downloaddir=/tmp <package-name>

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

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

Yum Install Yum-plugin-downloadonly

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

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 suite of help tools for managing yum packages.

Yum Install Yum-utils

Download an RPM Package:

Yumdownloader <package-name>

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

Download RPM Package in Cenos

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.