Getting started with Linux: Use yum to download the RPM package without installing it

Source: Internet
Author: User
Q: I want to download an RPM package from the standard repository of RedHat. Can I use the yum command to download an RPM package without installing it? Yum is the default Package Manager on RedHat-based 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 obtain some RPM packages for future use, or install them in

Problem: I want to download an RPM package from the standard repository of Red Hat. Can I use the yum command to download an RPM package without installation?

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 can be used to download an RPM package. The standard yum command provides-- Downloadonly (download only)To achieve this goal.

  1. $ sudo yum install --downloadonly

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

  1. /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 ):

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

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 ).--downloadonlyCommand Options:

  1. $ sudo yum install yum-plugin-downloadonly

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

  1. Command line error:no such option:--downloadonly

 

Method 2: Yumdownloader

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

  1. $ sudo yum install yum-utils

Download an RPM package:

  1. $ sudo yumdownloader

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.

Setup http://www.linuxidc.com/Linux/2015-01/111266.htm for using a DVD as the default yum source in CentOS

RedHat 6.2 Linux modify yum source free use CentOS source http://www.linuxidc.com/Linux/2013-07/87383.htm

Configure epel yum source http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat local yum source configuration http://www.linuxidc.com/Linux/2012-11/75127.htm

Yum profile description http://www.linuxidc.com/Linux/2013-04/83298.htm

Install yum http://www.linuxidc.com/Linux/2013-06/86535.htm in RedHat 6.1

YUM installation and cleaning http://www.linuxidc.com/Linux/2013-07/87163.htm

Build yum local ground source http://www.linuxidc.com/Linux/2014-07/104533.htm on CentOS 6.4

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-03/115331.htm

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.