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

Source: Internet
Author: User

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

Q: 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 installing it?

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 <package-name>

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 <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 ).--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 <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.

How to Set DVD as the default yum source in CentOS

RedHat 6.2 modify yum source in Linux use CentOS source for free

Configure the epel yum Source

Redhat local yum source configuration

Description of yum configuration file

Install yum in RedHat 6.1)

YUM installation and cleaning

Build yum local source on CentOS 6.4

This article permanently updates the link address:

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.