In this Linux quick tip we will be showing you how to install local rpm files in CentOS, Red Hat and most other rpm based systems like Fedora.

Most software can be installed by using the Graphical Software Center or repositories. Occasionally you come across a piece of software that is only available via rpm package. Here we will discuss how to install that local rpm file after you have downloaded it.

Using the rpm Command

To install a local rpm file:

rpm -ivh filename.rpm

You will need change to the download directory, or specify the path to the file like so:

rpm -ivh /path/to/filename.rpm

Using the yum Command

You can use yum to install local rpm files as well. This has the added benefit of managing any dependencies the file may have. Yum will download all dependencies automatically if they are available in the currently configured repositories.

yum localinstall /path/to/filename.rpm

You can also use localinstall to download from an http or ftp site:

yum localinstall ftp://example.com/filename.rpm

Using the dnf command

Installing a local rpm package with the dnf command is no different than installing it normally. If you provide a path to an rpm file, it will install and check dependencies.

dnf install /path/to/filename.rpm

Conclusion

You should not be able to install a local rpm file using one of the above exampled (depending on your system). I always recommend installing software via a repository if possible, but that is not always feasible.

Remember, when you install a package from a local rpm file, most times it be automatically updated. You will have to go download the updated rpm file and update it manually.

Another huge benefit of using one of the package managers is dependencies. The yum and dnf commands will automatically identify any dependencies needed and trigger the installations. When you run an update it will see there is an updated package in the repo and automatically update it. That is +2 for package managers.