Saturday, 16 March 2019

Using yum to download a package and all it's associated dependencies

This tutorial will demonstrate how to do a download-only of a package and all of it's dependancies.

To elaborate - I recently installed Fedora 29 on a Macbook, but unfortunately there was no native support for the WLAN driver.

However it was available from RPMFusion - packaged under 'akmod-wl' - however downloading this and all of it's dependancies would have taken a long time - so instead we can use plugin for yum called 'yum-downloadonly':

yum install yum-downloadonly

We can then issue something like follows to download the required packages on a working computer which is running Fedora 29 (though ensure it is running exactly the same minor version as well!):

sudo yum install --downloadonly --downloaddir=/tmp akmod-wl

However this is not ideal largely due to the fact that it will download all required packages that the system needs. If some of these packages are already installed on the system they will be omitted.

So instead I came up with the idea of quickly building a jail with the basic packages to get yum up and running (this would mimic the newly installed OS):

mkdir -p /chroot/fedora29/var/lib/rpm

rpm --root /chroot/fedora29 --initdb

yumdownloader --destdir=/var/tmp fedora-release
cd /var/tmp
rpm --root /chroot/fedora29 -ivh --nodeps fedora-release*rpm

sudo yum install --installroot=/chroot/fedora29 --downloadonly --downloaddir=/tmp akmod-wl

Then copy everything from the temp folder onto the new workstation and issue:

rpm -i *

0 comments:

Post a comment