3

Is there a way to identify an unused repository in Centos/RHEL?

I have quite a few repositories installed on a Centos machine and I'm not sure which ones are actually needed and which ones aren't.

Is there a good way to generate a report that uses the installed package list and identifies which repositories that are still used and which ones aren't?

2 Answers 2

3

If you're on CentOS 6, the following command should show you which repo your installed RPMs came from:

rpm -qa | xargs yum info | grep '^From repo' | sort | uniq -c | sort -rn

If you're on CentOS 5 or lower, there's no 100% definitive way to get the info you want. You're going to have to go through the currently installed RPMs and try to correlate them to the various repos you have set up. There's a few ways to correlate them:

  1. Some repos like repoforge/rpmforge and IUS but a suffix on their RPMs you can grep out with something like rpm -qa release='*rf*'

  2. Correlate the packager, buildhost, signature, or vendor to the various repos. For example, if the buildhost has 'fedoraproject.org' in it, it probably came from the EPEL repo. Or if the vendor is listed as 'RPM Fusion' then it probably came from the rpmfusion repo. Every repo is different in terms if they actually use the fields and what they put in them.

    The packager, buildhost, and vendor can theoretically be spoofed so depending on your security needs you might not want to depend on them but the probability someone is maliciously doing this is kind of low. The signature would be the most secure one.

    The repos are below. You'd query all of your rpms and sort the output with something like rpm -qa --queryformat '%{vendor}\t%{name}\n' | sort

    • Packager - %{packager}
    • BuildHost - %{buildhost}
    • Signature - %{RSAHEADER:pgpsig}
    • Vendor - %{vendor}

This entry on the CentOS wiki might be of assistance.

0

To find out which repos. packages are installed from you can do:

repoquery --installed --qf '%{ui_nevra} %{ui_from_repo}' -a

...or, for a summary:

repoquery --installed --qf '%{ui_from_repo}' -a | sort | uniq -c

...if you remove the "--installed" switch that will tell you which repos. have the latest version of a package available (so if repos. foo and bar provide XYZ then only the one providing the latest version is listed). That might be closer to what you want. As a faster check the other thing is that "yum repolist" will give you a count of the number of packages available in each repo. ... which might be enough to see if they are worthwhile.

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.