How to know from which yum repository *URL* a package has been installed?

monster asked:

My sysadmin would like a proxy whitelist for some old CentOS sever I am trying to update (until now, it was cut off from the Internet).

I asked to have full Internet access, so I can just update everything, and install some more, and then send him the list of URLs that were needed for the update, so he can switch to a whitelist.

Unfortunately, the URLs used are not logged in /var/log/yum.log.

I came upon this question:
How to know from which yum repository a package has been installed?

It tells me the “From repo”, but this is just a “logical name” which can map to many URLs, and change over time, and “URL” is the “creator/source” of the package, not where it was physically downloaded from.

Is there somewhere else, where I can extract the URLs that yum used to install/update, or maybe can I configure the logging of yum to also log that information?

Currently, updating a package just produces something like this in the logs:

May 18 18:04:07 Updated: 1:busybox-1.15.1-21.el6_6.x86_64

My answer:

The repo URLs are in the yum configuration files in the /etc/yum.repos.d directory.

Keep in mind that most CentOS repos use mirrorlists, which contain the URLs of every possible CentOS mirror, and any given package might have been downloaded from any mirror.

On EL 7 you can find the specific URL a package was downloaded from in the file /var/lib/yum/yumdb/[a-z]/[unique-id-packagename]/origin_url. This information will not be made available in EL 8.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.