I have inherited an ugly script for installing some code onto an old centos relesae, I'm trying to get the original script to work before upgrading to a proper RPM.

Currently the script is trying to install a number of RPMs in a directory, the install will go on a computer without internet access or yum repos. It was failing using rpm -ivh * because some of the RPMs were dependent on other RPMs in the same directory, and the rpm command would try to install them out of order.

I'm looking for the cleanest approach to do the install. I thought yum localinstall would work, but it first attempts to load the rpm from it's repos before using the RPMs in the directory, leading to a failure due to the lack of connectivity. I'm also not certain if it will appropriatly install the RPMs in order.

What is the cleanest approach for installation? I also believe I may need the --nogpgcheck argument?

  • How old is that old? I don't recall having problems with yum localinstall *.rpm on CentOS 5. (Also, you can/should set all the online repos in /etc/yum.repos.d to enabled=0 if the machine isn't online anyway.) Commented Apr 12, 2017 at 15:41
  • @UlrichSchwarz centos 3, when I say old I mean old :P and I agree about changing the ym.repos, but again I don't know rather or not the ones maintaining the system will do it properly, at least one didn't...
    – dsollen
    Commented Apr 12, 2017 at 17:01

2 Answers 2


You could create a repository containing those RPMs. cd to the directory containing them, then run

createrepo .

next, add a .repo file to your /etc/yum.repos.d with a file:// URL to your directory.

You should now be able to install those packages with a "normal" yum install.

yum localinstall *.rpm 

works in centos 7

  • 3
    The OP stated that no internet connection is available, so yum would not be able to resolve the dependencies when running this command.
    – ckujau
    Commented Sep 28, 2020 at 6:26
  • It seems like a fuller answer would be as per this other question
    – asoundmove
    Commented Sep 28, 2020 at 21:09
  • @ckujau but if all dependencies are downloaded to the same dir, it would work. Commented Oct 9, 2020 at 6:18
  • if you were used repotrack to download all packages and deps, this works like a charm Commented Nov 23, 2021 at 9:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .