14

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
  • 452

2 Answers2

28

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

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • 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)? – ukll Aug 16 '16 at 18:34
  • 1
    You're welcome! Yes, there is a way to show all of your history. Just do yum history list all. – Jason Powell Aug 16 '16 at 19:00
12

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
GAD3R
  • 66,769