4

I'm attempting to create a local yum repo on my system containing various packages from, chiefly, the CentOS base repos. The server which is hosting the yum repo will not necessarily have the same base packages installed by default as the servers which will be using the yum repo. For this reason, I need to ensure that my repos contain the packages that I want and every single one of their dependencies.

I'm creating my repos using the yumdownloader tool provided in the yum-utils package to try to download an RPM file for a package using yum from the standard CentOS mirrors. Helpfully it provides a command line option, --resolve, which also downloads dependencies. However, because it's built on yum itself, yumdownloader will only download dependencies for the package that are not already present on the system.

For example, I wish to download package A, which depends on Packages B, C and D. If package D is already installed on the system, yumdownloader --resolve A will only download A, B and C, but not D.

Is there a way to download the RPMs for all dependencies on a package from a yum repo?

RikSaunderson
  • 3,505
  • 6
  • 32
  • 50
  • 2
    Duplicate of http://serverfault.com/questions/470964/yumdownloader-vs-repotrack which contains both the answers I was going to write up here. – Etan Reisner Oct 06 '14 at 12:59

2 Answers2

1

There's this bash script, which the maintainer of rpm has kindly shared with me, and I put on github. Hope you find it useful!

You can also read the original SO question, where the issue was discussed.

The script works on Fedora 23+ as it uses dnf's download plugin. It's probably very easy to make it work on Fedora 22-, as yum surely has got a similar plugin.

Additionaly, it's valuable since repotrack does not work on fedora 23 (at least it doesn't work for me).

Community
  • 1
  • 1
Adam Kurkiewicz
  • 1,526
  • 1
  • 15
  • 34
1

After a lot of frustration looking around for a solution I have written a simple script that uses repotrace and wget. I've found that yumdownloader (even with the resolve flag) does not resolve all dependencies.

if you have a long list of packages you are bound to run into duplicates, downloading just the urls first with the "repotrack -u flag" and then getting unique records resolves having to download the same rpm multiple times.

#!/bin/bash

while read i; do
    repotrack -u $i >> dep_rpm_urls_02.txt
done < list_of_packages_01.txt


awk '!seen[$0]++' dep_rpm_urls_02.txt > dep_rpm_urls_clean_03.txt

while read j; do
    wget $j
    echo dowloaded $j
done < dep_rpm_urls_clean_03.txt

happy rpming

Nazilla
  • 581
  • 1
  • 7
  • 17