how to remove all installed dependent packages while removing a package in centos 7?

50,743

Solution 1

Personally, I don't like yum plugins because they don't work a lot of the time, in my experience.

You can use the yum history command to view your yum history.

[root@testbox ~]# yum history
Loaded plugins: product-id, rhnplugin, search-disabled-repos, subscription-manager, verify, versionlock
ID     | Login user               | Date and time    | Action(s)      | Altered
----------------------------------------------------------------------------------
19 | Jason <jason>  | 2016-06-28 09:16 | Install        |   10

You can find info about the transaction by doing yum history info <transaction id>. So:

yum history info 19 would tell you all the packages that were installed with transaction 19 and the command line that was used to install the packages. If you want to undo transaction 19, you would run yum history undo 19.

Alternatively, if you just wanted to undo the last transaction you did (you installed a software package and didn't like it), you could just do yum history undo last

Solution 2

yum remove package_name will remove only that package and all their dependencies.

yum autoremove will remove the unused dependencies

To remove a package with it's dependencies , you need to install yum plugin called: remove-with-leaves

To install it type:

yum install yum-plugin-remove-with-leaves

To remove package_name type:

yum remove package_name --remove-leaves
Share:
50,743

Related videos on Youtube

ukll
Author by

ukll

Updated on September 18, 2022

Comments

  • ukll
    ukll almost 2 years

    I am using CentOS 7. I installed okular, which is a PDF viewer, with the command:

    sudo yum install okular
    

    As you can see in the picture below, it installed 37 dependent packages to install okular.

    installed dependencies

    But I wasn't satisfied with the features of the application and I decided to remove it. The problem is that if I remove it with the command:

    sudo yum autoremove okular
    

    It only removes four dependent packages.

    removed packages with autoremove

    And if I remove it with the command:

    sudo yum remove okular
    

    It removes only one package which is okular.x86_64.

    Now, my question is that is there a way to remove all 37 installed packages with a command or do I have to remove all of them one by one?

  • ukll
    ukll almost 8 years
    I tried your answer, it doesn't work.
  • ukll
    ukll almost 8 years
    Firstly, thank you for your excellent answer. And secondly, when I did sudo yum history, it showed only actions with id 30 through 49. Is there a way to view all actions history (including with id 1-29)?
  • Jason Powell
    Jason Powell almost 8 years
    You're welcome! Yes, there is a way to show all of your history. Just do yum history list all.