How to Uninstall RPM in Linux [2 Simple Cases]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

RPM is a red-hat package manager enabling you to install, remove, query, verify and update RPM packages in Unix/Linux systems. This powerful management tool is a free and open-source program that anyone can use. Some rpm packages have dependencies that are required to function in other vital packages. This package manager only works in red-hat-based distros like CentOS, RHEL, and Fedora, not in Debian-based distros like Ubuntu. In this article, I will show you how to uninstall rpm packages in Red-Hat Enterprise Linux with or without dependencies by using the rpm command.

[Distro Used Throughout the Tutorial: RHEL 9.2]describing two cases of how to uninstall rrpm package

2 Simple Cases to Uninstall RPM From Unix/Linux-based Systems

Many popular red hat-based distros like Fedora, CentOS, and RHEL by default use rpm (red-hat package manager) to install, uninstall, and upgrade rpm packages directly into the system. So, you don’t need to convert the rpm packages to any other format. Now, I will explain to you the uninstallation procedure of the google chrome software package. Follow the steps carefully:

NOTE: Before removing any packages, having backups is always appreciable. As most rpm packages have dependencies when you uninstall any package that can hamper other dependencies depending on it.

1. Uninstalling Packages Without Reliant Dependencies Using “rpm” Command

Some dependencies are dependent on other packages. For that reason, removing those can damage other packages. Hence, follow these steps to avoid this problem:

  1. First, open the Red-hat Enterprise terminal.
  2. Click ‘Show Applications’ to check the installed package you are going to remove.checking installed rpm package of google chrome software
  3. Now, write the code to remove the google chrome package without its reliant dependencies:
    sudo rpm -e google-chrome-stable
    EXPLANATION
    • sudo: Gives administrative privileges.
    • rpm: Red-hat package manager to install, uninstall, and manage software packages.
    • -e: Command option to erase software package.
    • google-chrome-stable: Package name.

    running rpm command to uninstall package

    After executing the command, you can check that there is no google chrome software available in your Linux system.

    checking to ensure that the rpm package of the google chrome software is uninstalled successfully

    In this image, you can see that the google chrome software is no longer here.

2. Uninstalling Packages With All Dependencies Using “rpm” Command

The previous rpm code can remove packages with their unused dependencies but not all the dependencies. In this case, I will show you how to delete all the dependencies of a package whether they are in use or not. Now, follow steps as instructed below:

  1. Write this command to query all the rpm packages:
    rpm -qa

    command to query all the rpm packages

  2. Now, scroll down and find the google chrome package.finding the rpm package to uninstall
  3. After finding the Google Chrome package, write the next command to remove it with all the dependencies.
    Sudo rpm -e --nodeps google-chrome-stable

    removing google chrome rpm package with all its dependencies

    After typing the password, you will find that the google chrome software is uninstalled from your system with all the dependencies.

Options for RPM

These options may help you get more control over the rpm command:

Command (short form) Description
– – install (-i) Installs packages.
– – force (-f) Forces the operation to proceed even if there are errors.
– – upgrade (-U) Upgrades packages.
– – list (-l) Lists files in a package.
– – query (-q) Queries packages.
– – hash (-h) Prints hash marks as the package installs.
– – verbose (-v) Provides more detailed output.
– – state (-s) Displays the state of the listed files.
– – verify (-V) Verifies packages.

Conclusion

I hope you can now easily uninstall any rpm package file you want to remove. In this article, I have explained 2 simple cases to do the job. You may go through any case you want. If you wish to remove a package with all dependencies go for case 02 otherwise go for case 01. Remember, don’t miss out on any steps, just follow the instructions attentively to complete your task successfully. Good luck!

People Also Ask

How can I uninstall RPM?

To uninstall an RPM package, you can use the rpm command with the -e flag. Here’s an example:

sudo rpm -e package_name

In this example, replace package_name with the name of the package you want to uninstall.

How to extract files from RPM without installing it?

You can convert the rpm file to a cpio format for extracting rpm files without installing it. Run command rpm2cpio package.rpm > package.cpio to convert the file then write cpio -idmv < package.cpio to extract files in your current directory.

What is inside RPM file?

RPM file contains all the necessary files and contents needed to install or distribute any software. It has metadata such as package name, version, dependencies, release, and other information about the package. Also, it contains scripts written in the shell run during package installation and removal. Moreover, a rpm package with a signature ensures the authenticity of the box.

Is it possible to uninstall RPM packages in Linux without dependencies using yum?

YUM (Yellowdog Updater Modified) is a red-hat-based package manager used to install, uninstall or modify software packages. Just write sudo yum remove - -nodeps package-name to uninstall your desired package without dependencies.

Related Articles


<< Go Back to Uninstall Packages in Linux | Package Management in Linux | Learn Linux Basics

4.8/5 - (5 votes)
Mitu Akter Mou

Hello, This is Mitu Akter Mou, currently working as a Linux Content Developer Executive at SOFTEKO for the Linuxsimply project. I hold a bachelor's degree in Biomedical Engineering from Khulna University of Engineering & Technology (KUET). Experiencing new stuff and gathering insights from them seems very happening to me. My goal here is to simplify the life of Linux users by making creative articles, blogs, and video content for all of them. Read Full Bio

Leave a Comment