yum install yum-plugin-downloadonly [root@linux-node1 ~] # yum install yum-plugin-downloadonly Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.tongji.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.cn99.com Package yum-3.4.3-158.el7.centos.noarch already installed and latest version Nothing to do [root@linux-node1 ~] # 创建目录用来缓存rpm包 [root@linux-node1 ~] # mkdir /data/rpm -p [root@linux-node1 ~] # 我们还可以指定软件包的下载路径。需要加入参数–downloaddir参数。 格式:yum install –downloadonly –downloaddir= your- dir package-name,如: 执行如下命令 [root@linux-node1 /data/rpms ] # yum install --downloadonly --downloaddir=/data/rpm gem [root@linux-node1 ~] # cd /data/rpm/ [root@linux-node1 /data/rpm ] # ll total 1012 -rw-r--r-- 1 root root 72560 Mar 5 21:47 ruby-2.0.0.648-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 84692 Mar 5 21:47 rubygem-bigdecimal-1.2.0-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 55044 Mar 5 21:47 rubygem-io-console-0.4.2-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 81180 Mar 5 21:47 rubygem-json-1.7.7-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 84160 Mar 5 21:48 rubygem-psych-2.0.0-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 329272 Mar 5 21:48 rubygem-rdoc-4.0.0-33.el7_4.noarch.rpm -rw-r--r-- 1 root root 224400 Mar 5 21:48 rubygems-2.0.14.1-33.el7_4.noarch.rpm -rw-r--r-- 1 root root 94056 Mar 5 21:48 ruby-irb-2.0.0.648-33.el7_4.noarch.rpm [root@linux-node1 /data/rpms ] # 离线安装本地rpm包 [root@linux-node1 ~] # rsync -a 10.0.3.62:/data/rpm /data/ [root@linux-node1 ~] # cd /data/ [root@linux-node1 /data ] # ll total 4 drwxr-xr-x 2 root root 4096 Aug 20 14:20 rpm [root@linux-node1 /data ] # cd rpm/ [root@linux-node1 /data/rpm ] # ll total 3932 -rw-r--r-- 1 root root 56068 Jan 30 2015 libyaml-0.1.4-11.el7_0.x86_64.rpm -rw-r--r-- 1 root root 72560 Mar 5 21:47 ruby-2.0.0.648-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 84692 Mar 5 21:47 rubygem-bigdecimal-1.2.0-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 55044 Mar 5 21:47 rubygem-io-console-0.4.2-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 81180 Mar 5 21:47 rubygem-json-1.7.7-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 84160 Mar 5 21:48 rubygem-psych-2.0.0-33.el7_4.x86_64.rpm -rw-r--r-- 1 root root 329272 Mar 5 21:48 rubygem-rdoc-4.0.0-33.el7_4.noarch.rpm -rw-r--r-- 1 root root 224400 Mar 5 21:48 rubygems-2.0.14.1-33.el7_4.noarch.rpm -rw-r--r-- 1 root root 94056 Mar 5 21:48 ruby-irb-2.0.0.648-33.el7_4.noarch.rpm -rw-r--r-- 1 root root 2931216 Mar 5 21:48 ruby-libs-2.0.0.648-33.el7_4.x86_64.rpm [root@linux-node1 /data/rpm ] # yum localinstall *.rpm -y |