I have a server that should contain all the RPM packages downloaded from CentOS repository so that I can reach that server from another server which hasn't got internet access and get the up to date packages to itself.

The thing is that, because of dependency issue, I can't download all of the packages. Below there are the commands that I tried.

$ repotrack -p . -a x86_64 *.rpm

Above command downloads 194 RPM packages. When I try with *rpm, again the same result.

$ yum install --downloadonly --installroot=/etc/yum.downloads/packets-installroot --downloaddir=/etc/yum.downloads *.rpm 

Above command downloads 179 RPM packages. When I try with *rpm, the packet count decreased.

$ yumdownloader --resolve --destdir=/etc/yum.downloads/ *.rpm

Above command downloads just 48 packages.

$ yum install --downloadonly --downloaddir=/etc/yum.downloads/ *rpm

Above command downloads just 48 packages.

These commands should download all RPM packages and dependencies whereas they don't. I'm trying the commands with specific 1 package also and they download its dependencies but whenever I try to download all packages, it fails to do that I guess.


I tried below command

$ repoquery --qf=%{name} -g --list --grouppkgs=all [groups] | xargs repotrack -a x86_64 -p .

It downloaded 4640 packages but still there is a problem. -g commands query groups instead of packages. So there are packages that hasn't got groups and I need to download them as well.

-a parameter is the solution to that I believe because in the manual it says that -a "query all". But still I couldn't find the true syntax for that. Does anybody know?

  • if you have your OS iso you can use that.there`s a folder named Pacakges which contain all of them. – BlackCrystal Oct 22 '18 at 8:40
  • I know that but I will write a script when I find the solution. The script will automatically download the up-to-date packages from repo (centos or rhel) and after that, the other machine will get those packages – G.Baysec Oct 22 '18 at 8:59
  • So basically you want to create internal repository, right? There are plenty of tutorials how to do it in the Internet. For example this one: tecmint.com/setup-yum-repository-in-centos-7 – mrc02_kr Oct 22 '18 at 11:23
  • I will definetely try rsync and write here if it worked – G.Baysec Oct 22 '18 at 11:52

I found the solution.

repoquery -a | xargs repotrack -a x86_64 -p .

wget -A rpm -r -l 5 http://mirror.centos.org/centos/7/os/x86_64/Packages/ -P .

You can use the following command:

To list all available packages in a specified repository, do:

repoquery -a --repoid=REPONAME

To download all the packages, use xargs with yumdownloader

repoquery -a --repoid=REPONAME| xargs -i -t yumdownloader {}

when repoid is the name of your remote repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.