How do I remove all rpms installed today with yum?
I am very familiar with
rpm -qa --last
and found it to be very handy in certain situations. However, on this occasion, I accidentally overdid it a little and set up a large group yum.
yum groupinstall "Development tools"
Is there an easy way to uninstall everything I just installed? It seems to me there must be some way to combine rpm request and rpm delete. that is, the output of the line from the query command to the delete command.
Update: Based on user feedback @ rickhg12hs
It was pointed out that I was seeing a transaction ID from yum history
which I was not aware of. This is what it looks like:
$ yum history
Loaded plugins: fastestmirror, security
ID | Login user | Date and time | Action(s) | Altered
----------------------------------------------------------------------------
69 | <jds> | 2015-05-11 01:31 | Install | 1
68 | <jds> | 2015-05-11 01:31 | Install | 1
67 | <jds> | 2015-05-11 01:10 | I, U | 210
66 | <jds> | 2015-05-05 12:41 | Install | 1
65 | <jds> | 2015-04-30 17:57 | Install | 2
64 | <ansible> | 2015-04-30 10:11 | Install | 1
63 | <ansible> | 2015-04-30 10:11 | Install | 1
62 | <ansible> | 2015-04-30 10:11 | Install | 1 EE
61 | <ansible> | 2015-04-30 10:11 | Install | 1
60 | <ansible> | 2015-04-30 10:11 | Install | 1
59 | <ansible> | 2015-04-30 09:58 | Install | 19 P<
58 | <ansible> | 2015-04-29 18:28 | Install | 1 >
57 | <ansible> | 2015-04-29 18:28 | Install | 1
56 | <ansible> | 2015-04-29 18:28 | Install | 9
55 | <ansible> | 2015-04-29 18:28 | Install | 3
54 | <ansible> | 2015-04-29 18:28 | Install | 1
53 | <ansible> | 2015-04-29 18:27 | I, U | 5
52 | <ansible> | 2015-04-29 18:27 | I, U | 4
51 | <ansible> | 2015-04-29 18:27 | Install | 1
50 | <ansible> | 2015-04-29 18:27 | Install | 1
and tada: here it is, the transaction ID.
I want to remove 67 from transaction id. So now that I am a little wiser, I have a new question.
So how can I use yum or rpm command to delete a transaction?
Note: I was also told what I can do
$ yum history info 67 |less
Loaded plugins: fastestmirror, security
Transaction ID : 67
Begin time : Mon May 11 01:10:09 2015
Begin rpmdb : 1012:bb05598315dcb21812b038a356fa06333d277cde
End time : 01:13:25 2015 (196 seconds)
End rpmdb : 1174:cb7855e82c7bff545319c38b01a72a48f3ada1ab
User : <jds>
Return-Code : Success
Command Line : groupinstall Additional Development
Transaction performed with:
Installed rpm-4.8.0-38.el6_6.x86_64 @updates
Installed yum-3.2.29-60.el6.centos.noarch @anaconda-CentOS-201410241409.x86_64/6.6
Installed yum-plugin-fastestmirror-1.1.30-30.el6.noarch @anaconda-CentOS-201410241409.x86_64/6.6
Packages Altered:
Dep-Install GConf2-2.28.0-6.el6.x86_64 @base
Install GConf2-devel-2.28.0-6.el6.x86_64 @base
Dep-Install ORBit2-2.14.17-5.el6.x86_64 @base
... snip ...
I think this can be quite useful under certain circumstances.
source to share
If you uninstall packages, then you run the risk of removing things that were already there, but may have been updated. Typically, you should use yum
(or the equivalent) for package management, which allows you to downgrade a package. This will remove new packages and shrink existing ones. See for example How to safely downgrade or uninstall glibc using yum and rpm
The selection of package names to downgrade can be done using the output rpm -qa
formatted to provide a simple selection of a given date. For example (see CentOS: List Installed RPMs by Install / Upgrade Date? ), You can list packages in reverse order of their install date using
rpm -qa --last
For a more sophisticated approach, you can use an option --queryformat
with an option :date
to format the date exactly the way you want (it uses strftime
).
In any case, you can make a script to extract the package names from the output rpm
, and use those packages with yum
(or even rpm
) to manage as needed.
When you downgrade, there is one strange thing to keep in mind: it updates the install date for packages to be the current date, not a complete cancellation using the previous date.
source to share