Category: Linux

Installing an RPM package with yum automatically resolves all the dependencies

To install an RPM package with the rpm command, you need to first resolve the dependencies. You can either query your system for dependencies:

rpm -qpR the-package.rpm

or try to install and observe the error message that shows a list of dependencies:

rpm -ivh the-package.rpm

Installing all the dependencies can be quite time consuming because the packages listed by the above commands may themselves depend on other packages that you have to install, resulting in a long dependency chain.

Alternatively, you can use yum to resolve all the dependencies automatically like this:

yum --nogpgcheck install the-package.rpm

Many thanks go to the developers of yum.

Restore file ownership and permissions in RPM based Linux distributions

If you have messed up the file permissions and ownerships of installed packages on your Linux box for any reason, you can fix these for all the packages that were installed by rpm. This method will only work for RedHat, CentOS, Fedora and other rpm based Linux distribution.

This will restore ownerships and then restore permissions for all installed packages

for p in $(rpm -qa); do rpm --setugids $p; done
for p in $(rpm -qa); do rpm --setperms $p; done