This page printed from: https://www.linuxmonth.com/issue1/tips/tip4.html?print=1
RPM (Redhat Package Manager) is an excellent package manager. RPM, created by Red Hat, can be used for building, installing, querying, updating, verifying, and removing software packages. This brief article will show you some of the usage of the rpm
tool.
So you have an rpm package that you wish to install. But you want to find out more information about the package, like who built it, and when was it built. Or you want to find out a short description about the package. The following command will show you such information.
rpm -qpi packagename.rpm
Now that you know more about the package, you're ready to install it. But before you install it you want to get a list of files and find out where will these files be installed. The following command will show you exactly that.
rpm -qpl packagename.rpm
To actually install the package, use:
rpm -i packagename.rpm
But what if I have an older version of the rpm already installed ? Then you want to upgrade the package. The following command will remove any older version of the package and install the newer version.
rpm -Uvh packagename.rpmHow do I check all the packages installed on my system ? The following will list their names and version numbers.
rpm -qaand to see all the packages installed with the latest ones on top.
rpm -qa --last
And if you want to see what package a file belongs to, if any, you can do the following. This command will show the rpm name or tell you that the file does not belong to any packages.
rpm -qf file
And if you wanted to uninstall the package, you can do the following.
rpm -e packagenameand to unistall even if it other packages depend on it. Note: This is dangerous; this should only be done if you are absolutely sure the dependency does not apply in your case.
rpm -e packagename --nodeps
There are a lot more comands to help you manage your packages better. But this will cover the thirst of most users. If you want to learn more about rpms type man rpm
at your prompt or visit www.rpm.org. In particular, see the RPM-HOWTO at www.rpm.org.