1. 程式人生 > >yum下載包&強制安裝

yum下載包&強制安裝

How to use yum to download a package without installing it ?

Resolution

There are two ways to download a package without installing it.

One is using the “downloadonly” plugin for yum, the other is using “yumdownloader” utility.

一、Downloadonly plugin for yum

1、Install the package including “downloadonly” plugin:

(RHEL5)
# yum install yum-downloadonly

(RHEL6)
# yum install yum-plugin-downloadonly

2、Run yum command with “–downloadonly” option as follows:

# yum install --downloadonly --downloaddir=<directory> <package>

3、Confirm the RPM files are available in the specified download directory.

Example:

yum install -y yum-downloadonly

yum install python -y --downloadonly --downloaddir=/opt

rpm -ivh --force --nodeps python.el6.x86_64.rpm

# --force 強制
# --nodeps 不考慮依賴性

二、Yumdownloader

If downloading a installed package, “yumdownloader” is useful.

1、Install the yum-utils package:

# yum install yum-utils

2、Run the command followed by the desired package:

# yumdownloader <package>