为了实现这个功能,需要用到:downloadonly 插件
1、安装downloadonly插件
yum install yum-plugin-downloadonly
2、下载某个软件及其依赖到本地的目录
yum install --downloadonly --downloaddir=<directory> <package-name>
示例:
安装python3,python3-devel包
yum install --downloadonly --downloaddir=/root/python36/ python36 python36-devel
执行后,进入目录,所有的依赖包,都在一个目录里了
[root@centos7 ~]# cd /root/python36/ [root@centos7 python36]# ls -ltr total 21756 -rw-r--r-- 1 root root 101080 Jul 3 2014 dwz-0.11-3.el7.x86_64.rpm -rw-r--r-- 1 root root 19672 Jul 4 2014 perl-Carp-1.26-244.el7.noarch.rpm -rw-r--r-- 1 root root 19244 Jul 4 2014 perl-constant-1.27-2.el7.noarch.rpm -rw-r--r-- 1 root root 1545440 Jul 4 2014 perl-Encode-2.51-7.el7.x86_64.rpm -rw-r--r-- 1 root root 29092 Jul 4 2014 perl-Exporter-5.68-3.el7.noarch.rpm -rw-r--r-- 1 root root 27088 Jul 4 2014 perl-File-Path-2.09-2.el7.noarch.rpm -rw-r--r-- 1 root root 57680 Jul 4 2014 perl-File-Temp-0.23.01-3.el7.noarch.rpm -rw-r--r-- 1 root root 78236 Jul 4 2014 perl-Filter-1.49-3.el7.x86_64.rpm -rw-r--r-- 1 root root 39292 Jul 4 2014 perl-HTTP-Tiny-0.033-3.el7.noarch.rpm -rw-r--r-- 1 root root 12592 Jul 4 2014 perl-parent-0.225-244.el7.noarch.rpm -rw-r--r-- 1 root root 84468 Jul 4 2014 perl-PathTools-3.40-5.el7.x86_64.rpm -rw-r--r-- 1 root root 114320 Jul 4 2014 perl-podlators-2.5.1-3.el7.noarch.rpm -rw-r--r-- 1 root root 88756 Jul 4 2014 perl-Pod-Perldoc-3.20-4.el7.noarch.rpm -rw-r--r-- 1 root root 221216 Jul 4 2014 perl-Pod-Simple-3.28-4.el7.noarch.rpm -rw-r--r-- 1 root root 27436 Jul 4 2014 perl-Pod-Usage-1.63-3.el7.noarch.rpm -rw-r--r-- 1 root root 36808 Jul 4 2014 perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm -rw-r--r-- 1 root root 4724 Jul 4 2014 perl-srpm-macros-1-8.el7.noarch.rpm -rw-r--r-- 1 root root 78888 Jul 4 2014 perl-Storable-2.45-3.el7.x86_64.rpm -rw-r--r-- 1 root root 14056 Jul 4 2014 perl-Text-ParseWords-3.29-4.el7.noarch.rpm -rw-r--r-- 1 root root 50392 Jul 4 2014 perl-threads-1.87-4.el7.x86_64.rpm -rw-r--r-- 1 root root 39868 Jul 4 2014 perl-threads-shared-1.43-6.el7.x86_64.rpm -rw-r--r-- 1 root root 46304 Jul 4 2014 perl-Time-HiRes-1.9725-3.el7.x86_64.rpm -rw-r--r-- 1 root root 24792 Jul 4 2014 perl-Time-Local-1.2300-2.el7.noarch.rpm -rw-r--r-- 1 root root 57176 Apr 25 2018 perl-Getopt-Long-2.40-3.el7.noarch.rpm -rw-r--r-- 1 root root 91396 Aug 22 2019 libtirpc-0.2.4-0.16.el7.x86_64.rpm -rw-r--r-- 1 root root 20044 Aug 22 2019 python3-rpm-generators-6-2.el7.noarch.rpm -rw-r--r-- 1 root root 644052 Aug 22 2019 python3-setuptools-39.2.0-10.el7.noarch.rpm -rw-r--r-- 1 root root 83048 Aug 22 2019 redhat-rpm-config-9.1.0-88.el7.centos.noarch.rpm -rw-r--r-- 1 root root 49868 Apr 3 2020 perl-Socket-2.010-5.el7.x86_64.rpm -rw-r--r-- 1 root root 1702324 Oct 14 2020 python3-pip-9.0.3-8.el7.noarch.rpm -rw-r--r-- 1 root root 8252 Oct 14 2020 python3-rpm-macros-3-34.el7.noarch.rpm -rw-r--r-- 1 root root 9368 Oct 14 2020 python-rpm-macros-3-34.el7.noarch.rpm -rw-r--r-- 1 root root 8960 Oct 14 2020 python-srpm-macros-3-34.el7.noarch.rpm -rw-r--r-- 1 root root 71844 Nov 18 2020 python3-3.6.8-18.el7.x86_64.rpm -rw-r--r-- 1 root root 222028 Nov 18 2020 python3-devel-3.6.8-18.el7.x86_64.rpm -rw-r--r-- 1 root root 7286976 Nov 18 2020 python3-libs-3.6.8-18.el7.x86_64.rpm -rw-r--r-- 1 root root 8360316 Feb 3 2021 perl-5.16.3-299.el7_9.x86_64.rpm -rw-r--r-- 1 root root 706128 Feb 3 2021 perl-libs-5.16.3-299.el7_9.x86_64.rpm -rw-r--r-- 1 root root 45324 Feb 3 2021 perl-macros-5.16.3-299.el7_9.x86_64.rpm -rw-r--r-- 1 root root 53064 Feb 3 2021 perl-Pod-Escapes-1.04-299.el7_9.noarch.rpm [root@centos7 python36]#
标签:rw,--,rpm,perl,本地,软件包,root,el7 From: https://www.cnblogs.com/chuanzhang053/p/16966121.html