2

I need to download .rpm packages into Windows for some reason. So I cannot use yum for downloading. Virtual machine option is not available either.

Can I download .rpm packages manually? If yes, what should I do? Dependency issue should be solved also.

trxrg
  • 45

2 Answers2

3

Concerning your dependencies issues you an use yum deplist [package]. That will return you a list for the package you listed in the commandline.

You can easily download the rpms once you know the mirrors you got them from if you are up-to-date. Because packages are overwritten regularly with new ones.

If you use CentOS you probably use EPEL repo (confirm with yum repolist). In that case you can browse : https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/ or https://dl.fedoraproject.org/pub/epel/7Server/x86_64/Packages/ depending on your version.

If it's from a custom repo, you can check in /etc/yum.repos.d/your_repo.conf and look for the line baseurl. You might find something like : baseurl=http://custom.repo.example.com/pub/7/$basearch In that case you have to change $basearch by x86_64 most probably. You might also have to change 7 to something else. And you'll be able to access it from any browser (you should go in the Packages directory once there).

Yum repos are basically just served by webservers, so you can browse them easily and find the packages you need.


If you happen to be out-of-date there might be a change that you have a local copy of the package you installed in your yum cache. Run find /var/cache/yum/ -name "your_package_name*.rpm" and cross fingers that it returns something interesting.

You could copy it from there and transfer it to your Windows machine, using any way you'd like.

1

tl;dr: This answers only the download/extract on Windows, not dependency management. Add repodata/repomd.xml to the repository's base url and then examine repomd.xml to locate and download its primary.xml file which lists the urls to download desired .rpm file(s). The script rpm2cpio.sh can extract the (compressed) cpio archive which cpio -id can then copy into the filesystem.

First, find the base url for the repository; e.g.
https://brave-browser-rpm-beta.s3.brave.com/x86_64/

Add repodata/repomd.xml to find the repository metadata; e.g.
https://brave-browser-rpm-beta.s3.brave.com/x86_64/repodata/repomd.xml

Examine repomd.xml to find the repository's primary.xml file; e.g. repodata/2635976bb02dab08a696dbaad778feea3f3351a3238fb6f77af52c651dd931cd-primary.xml.gz

Download primary.xml for the repository; e.g.

curl --output primary.xml.gz https://brave-browser-rpm-beta.s3.brave.com/x86_64/repodata/2635976bb02dab08a696dbaad778feea3f3351a3238fb6f77af52c651dd931cd-primary.xml.gz
gunzip primary.xml.gz

or use another download tool. Uncompress the file if it's compressed.

Examine primary.xml to locate the the desired .rpm archive.

grep location primary.xml

or perhaps

findstr "location" primary.xml

Download the desired .rpm file(s); e.g.

curl -O https://brave-browser-rpm-beta.s3.brave.com/x86_64/brave-browser-beta-0.67.99-1.x86_64.rpm

To unpack the contents from the .rpm file, here are some suggested utilities. Install Cygwin to run the rpm2cpio.sh script which extracts the cpio archive (probably compressed) from the .rpm file. (Use Cygwin's setup-x86_64.exe to install any script dependencies if necessary). Example:

rpm2cpio.sh brave-browser-beta-0.67.99-1.x86_64.rpm > payload

Install cpio and gunzip, xz, or bunzip using Cygwin's setup-x86_64.exe depending on how the cpio archive is packed. Figure out the format of the payload:

file payload

Now uncompress and then extract the cpio archive (An XZ compressed cpio archive in this example):

xz -d payload
cpio -id payload

Edit: alien is a much more versatile package format converter than rpm2cpio.sh. It's written in Perl. Also note that while this handles downloading and extracting RPMs on Windows (with Cygwin), it doesn't handle dependency management.

M.W.
  • 111