I can speak only for CentOS, not Fedora, where DNF is the default. It requires yumdownloader, which may or may not be in the Fedora repos, no idea. But I guess DNF's download option will do the same.
Code:
# yum repolist
Zavedené moduly: fastestmirror, langpacks, nvidia, priorities
Loading mirror speeds from cached hostfile
* base: ftp.sh.cvut.cz
* elrepo: fr.mirror.babylon.network
* epel: mirror.karneval.cz
* extras: mirror.karneval.cz
* nux-dextop: mirror.li.nux.ro
* updates: ftp.sh.cvut.cz
586 packages excluded due to repository priority protections
ID repozitáře: Název repozitáře: Stav:
base/7/x86_64 CentOS-7 - Base 9*363
So, now just simple:
Code:
# yumdownloader --disablerepo=* --enablerepo=base *
Zavedené moduly: fastestmirror, langpacks, nvidia, priorities
Loading mirror speeds from cached hostfile
* base: ftp.sh.cvut.cz
No Presto metadata available for base
(1/9363): 389-ds-base-devel-1.3.5.10-11.el7.x86_64.rpm | 195 kB 00:00:00
(2/9363): ElectricFence-2.2.2-39.el7.i686.rpm | 35 kB 00:00:00
(3/9363): ElectricFence-2.2.2-39.el7.x86_64.rpm | 35 kB 00:00:00
(4/9363): 389-ds-base-snmp-1.3.5.10-11.el7.x86_64.rpm | 150 kB 00:00:00
(5/9363): 389-ds-base-libs-1.3.5.10-11.el7.x86_64.rpm | 664 kB 00:00:01
(6/9363): GConf2-3.2.6-8.el7.i686.rpm | 1.0 MB 00:00:01
(7/9363): GConf2-3.2.6-8.el7.x86_64.rpm | 1.0 MB 00:00:01
(8/9363): 389-ds-base-1.3.5.10-11.el7.x86_64.rpm | 1.7 MB 00:00:02
(9/9363): GConf2-devel-3.2.6-8.el7.x86_64.rpm | 110 kB 00:00:00
(10/9363): GConf2-devel-3.2.6-8.el7.i686.rpm | 110 kB 00:00:00
(11/9363): GeoIP-devel-1.5.0-11.el7.i686.rpm | 14 kB 00:00:00
(12/9363): GeoIP-devel-1.5.0-11.el7.x86_64.rpm | 14 kB 00:00:00
(13/9363): GeoIP-update-1.5.0-11.el7.noarch.rpm | 8.7 kB 00:00:00
(14/9363): GeoIP-1.5.0-11.el7.x86_64.rpm | 1.1 MB 00:00:01
(15/9363): GeoIP-1.5.0-11.el7.i686.rpm | 1.1 MB 00:00:01
(16/9363): ImageMagick-c++-6.7.8.9-15.el7_2.i686.rpm | 152 kB 00:00:00
(17/9363): ImageMagick-c++-6.7.8.9-15.el7_2.x86_64.rpm | 145 kB 00:00:00
(18/9363): ImageMagick-c++-devel-6.7.8.9-15.el7_2.i686.rpm | 96 kB 00:00:00
(19/9363): ImageMagick-6.7.8.9-15.el7_2.i686.rpm | 2.1 MB 00:00:02
(20/9363): ImageMagick-c++-devel-6.7.8.9-15.el7_2.x86_64.rpm | 96 kB 00:00:00
(21/9363): ImageMagick-devel-6.7.8.9-15.el7_2.x86_64.rpm | 100 kB 00:00:00
(22/9363): ImageMagick-devel-6.7.8.9-15.el7_2.i686.rpm......................
I will of course not wait for it all to finish.
It will by default download all packages to PWD. Also, if it's a repo where older and newer verions of the same package are present, only the latest version will download.
To create local repo metadata, again the simple thing:
Code:
# createrepo /path/to/base
You'll of course have to create the repo file manually, but it's simple and one can use the existing repo files as template.
P.S. I think that Fedora uses somewhat different tool, createrepo_c I think? but it works the same way.