Yum install package and all its dependencies from local directory

yum

I have downloaded a package and all of its dependencies using yum's download only option into a local directory. I want to then install the package and its dependencies from that directory by passing yum the name of the rpm that contains the primary package in a manner similar to how pip lets you install wheel packages from local directories (provided the wheel files for the dependencies are also present). I DO NOT want yum to try and download the dependencies from a remote repo.
Basically I want this only for yum:

pip install --no-index --find-link=/directory-with-wheel-files primary_package.whl

I have used these links to try and solve my problem:

How to make rpm auto install dependencies

https://unix.stackexchange.com/questions/281715/how-can-i-install-a-local-rpm-using-only-the-local-dependency-rpm-files?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

https://wiki.centos.org/HowTos/CreateLocalRepos

https://www.ostechnix.com/install-packages-specific-repository-linux/

My repo file looks like this:

[basemap]
name=Basemap
baseurl=file:///var/tmp/install/basemap
enabled=1
gpgcheck=0

and my folder /var/tmp/install/basemap has been turned into a repo using yum's createrepo. Yet when I run yum --enablerepo=basemap install primary_package.rpm yum still tries to download the dependencies from the internet. How do I force it to look in my local repo for the dependencies?

Best Answer

Figured it out. I had one option missing from my yum command. I had to disable other repos and then enable only my repo. This command worked:

yum --disablerepo='*' --enablerepo=myrepo install primary_package.rpm
Related Topic