Yum命令之僅下載rpm安裝包且不安裝

退役小学生發表於2024-07-31
# 檢查是否已安裝此命令
[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

相關文章