What's the difference between `yum install <local path>` and `yum localinstall <local path>`

boardrider asked:

If I have an RPM located on a local disk –
what is the diffrefence between the following yum commands?

sudo yum install /tmp/rpm_name.rpm
sudo yum localinstall /tmp/rpm_name.rpm

I use RedHat/CentOS 7.

My answer:

In RHEL 5 and previous versions, yum install only accepted package names from enabled repositories, and did not accept paths to local RPMs; you had to use yum localinstall to install these.

In RHEL 6 and later, yum install accepts both package names and local filenames, so localinstall is no longer necesary, but it’s included for backward compatibility.

In RHEL 8, dnf localinstall is simply an alias for dnf install.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.