Yum命令之仅下载rpm安装包且不安装

# 检查是否已安装此命令
[root@centos7 ~]# which iperf
/usr/bin/which: no iperf in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

# 仅下载rpm安装包且不安装此命令
[root@centos7 ~]# yum install --downloadonly --downloaddir=temp iperf

# 检查
[root@centos7 ~]# which iperf
/usr/bin/which: no iperf in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

# 会在当前目录下生成一个 temp 目录,rpm安装包会下载到该目录下
[root@centos7 ~]# ll
总用量 0
drwxr-xr-x 2 root root 43 7月  31 16:38 temp

[root@centos7 ~]# ls temp/
iperf-2.0.13-1.el7.x86_64.rpm

# 检查rpm安装包的可行性
[root@centos7 ~]# rpm -ivh temp/iperf-2.0.13-1.el7.x86_64.rpm 

[root@centos7 ~]# which iperf
/usr/bin/iperf