28

I am trying to locally install an rpm package without using the internet. I tried the following:

sudo rpm -u kernel-devel-4.2.7-200.fc22.x86_64.rpm

and I got:

error: kernel-devel-4.2.7-200.fc22.x86_64.rpm: hdr blob(2060952): BAD, read returned 0
error: kernel-devel-4.2.7-200.fc22.x86_64.rpm cannot be installed

I also tried:

sudo dnf --disablerepo='*' install kernel-devel-4.2.7-200.fc22.x86_64.rpm

and it still seems to be using the internet, so I can't figure out if it works or not since the internet connection is really slow.

Is there a way to fix this?

4
  • sudo dnf install /path/to/package.rpm Commented Dec 13, 2015 at 23:28
  • @ILMostro_7 Thanks, but it's still using the internet. Commented Dec 13, 2015 at 23:36
  • 1
    @ILMostro_7 actually sorry, it works now. Thanks. Commented Dec 13, 2015 at 23:50
  • Sounds good. In that case, please accept the answer as the correct solution. Commented Jul 30, 2020 at 11:56

2 Answers 2

48

sudo dnf install /path/to/package.rpm will act on the package in the given path.

7
  • 7
    When trying this on a LIVE cd, I have to add --disablerepo=* Commented Mar 28, 2018 at 16:36
  • @Andy, I'm not sure if that's something that has changed with recent versions of dnf, but I don't see why you wouldn't be able to install the package locally by explicitly providing the full path to the rpm file as suggested in the answer. Commented Mar 30, 2018 at 4:14
  • I found out that in the end, you are right. What was happening for me, is that I was trying to install 10 RPMs, but I was accidentally missing one dependency. I had never run a dnf command online, so my yum cache was empty. Without --disablerepo, all I got was an error message failing to update the "Updates" repo. So I had no idea what the error was, but with the --disablerepo, I got a nice clear message that I was missing an package. Commented Apr 3, 2018 at 2:36
  • 3
    I'll answer my own comment, localinstall is a deprecated alias for install : dnf.readthedocs.io/en/latest/command_ref.html Commented Oct 30, 2019 at 19:10
  • 1
    @ILMostro_7, in my case the system does not have access to the repositories over the network and the installation hangs when updating the metadata. So --disablerepo=* skips updating the metadata and starts installing the local package right away. Commented Dec 13, 2022 at 12:28
2
sudo dnf localinstall kernel-devel-4.2.7-200.fc22.x86_64.rpm

This worked for me!

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.