If you’re using a Linux distribution that uses the RPM package format, you’re probably familiar with the RPM command. RPM stands for Red Hat Package Manager and is used to manage packages on Red Hat and its derivatives like Fedora, CentOS, and OpenSUSE.

Advertisement

In this tutorial, we’ll cover the basics of using the RPM command to install, upgrade, and remove packages on your Linux system.

Installing Packages with RPM Command

To install a package using the RPM command, you need to have the RPM package file on your system. You can either download the RPM package from the internet or use a package manager like yum or dnf to install it. Once you have the package file, open the terminal and run the following command:

sudo rpm -ivh package_name.rpm 

The -i flag is used to install the package, -v is for verbose output, and -h is to print a hash mark (#) for each file being installed. The package_name.rpm is the name of the RPM package you want to install.

Upgrading Packages with RPM Command

To upgrade a package using the RPM command, you need to have the newer version of the package available on your system. You can either download the RPM package from the internet or use a package manager like yum or dnf to upgrade it. Once you have the newer package file, open the terminal and run the following command:

sudo rpm -Uvh package_name.rpm 

The -U flag is used to upgrade the package, and the other flags have the same meanings as in the installation command. The package_name.rpm is the name of the RPM package you want to upgrade.

Querying RPM Packages

To list all installed RPM packages, use the following command:

rpm -qa 

To query information about a specific RPM package, use the following command:

rpm -qi package_name 

Replace package_name with the name of the RPM package you want to query.

Removing Packages with RPM Command

The package that is no more required, should be removed from the system. To remove a package using the RPM command, open the terminal and run the following command:

sudo rpm -e package_name 

The -e flag is used to erase or remove the package, and the package_name is the name of the RPM package you want to remove.

Conclusion

In this tutorial, we covered the basics of using the RPM command to install, upgrade, and remove packages on your Linux system. RPM is a powerful tool for managing packages on Red Hat and its derivatives like Fedora, CentOS, and OpenSUSE. Knowing how to use RPM can make it easier to manage packages on your Linux system.

Share.
Leave A Reply

Exit mobile version