yum 下载全量依赖 rpm 包及离线安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 查找rpm包的依赖列表
$ yum deplist ansible
Loaded plugins: fastestmirror
package: ansible.noarch 2.9.27-1.el7
dependency: /usr/bin/python2
provider: python.x86_64 2.7.5-93.el7_9
dependency: PyYAML
provider: PyYAML.x86_64 3.10-11.el7
......

# 下载全量依赖包
$ yum -y install yum-utils
$ repotrack ansible
Downloading PyYAML-3.10-11.el7.x86_64.rpm
Downloading ansible-2.9.27-1.el7.noarch.rpm
......

# 下载主软件包和基于当前系统缺少的依赖包
$ yum -y install yum-utils
$ yumdownloader --resolve --destdir=/tmp ansible

# 同上
$ yum -y install yum-download
$ yum -y install ansible --downloadonly --downloaddir=/tmp

# 离线安装rpm
$ rpm -Uvh --force --nodeps *.rpm