I'm in a situation similar to How can I install a local RPM using only the local dependency RPM files? or install a directory full of RPMs so that rpms providing dependencies are installed before dependent rpms?, but I'm on Fedora rather than CentOS and have DNF instead of Yum.

I have a bunch of .rpm files downloaded to a directory. I want to install one of them (let's say foo-1.0-1.rpm) and have its dependencies. I only want to install the required things, not all of the other files that have been downloaded, like foo-debuginfo-1.0-1.rpm and foo-extraplugin-that-no-one-uses-1.0-1.rpm. If I do dnf install *, I get all the extra junk. If I do just dnf install foo-1.0-1.rpm, I get errors about missing dependencies on bar and baz and foo-essential.

What should I do?


The answers for Yum suggest making a local repository and adding a repo configuration file to /etc/yum.repos.d. You could do that, but with DNF, you don't have to. You can just point to a local repo with no config file. You do need to create the repo in your directory, though.


  1. Change to the directory in question. cd ~/Downloads/RPMs, for example.
  2. run createrepo_c . in that directory. (Or createrepo_c ~/Downloads/RPMs from anywhere.)
  3. Run dnf --repofrompath local,. install foo


createrepo_c is a drop-in and faster replacement for createrepo.

The syntax for the provided repo is reponame comma path. So you could do --repofrompath "My Repository",/home/mattdm/Downloads/RPMs if you like. You can also provide a URL — either a file:/// URL or a remote one.

Remember to give the package you want installed as just the package name, like foo, rather than a file name, like foo-1.0-1.rpm.

And finally, if you have other configured repos that also provide foo and those are getting pulled in instead, well, that's going to be a problem in the future, but for now, you could use --disablerepo to get rid of the problematic other repo.

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.