Zapewne nie jestem jedyną osobom, której zdarza się czasem zainstalować jakiś program na serwerze tylko po to, by go sprawdzić, a potem mieć problem z usunięciem zarówno jego, jak i jego zależności. Można wykonać:
Jednakże nie zostaną usunięte zależności paczki.
Skorzystać można też z package-cleanup z paczki yum-utils poprzez wykonanie:
package-cleanup --leaves --all #samo leaves wyświetli listę sierot |
package-cleanup --leaves --all #samo leaves wyświetli listę sierot
Jednak to też nie jest rozwiązanie, którego potrzebujemy.
Wyświetlanie historii
[root@vps ~]# yum history list
Loaded plugins: fastestmirror, presto, replace
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
84 | root <root> | 2014-10-09 14:32 | Install | 45
83 | root <root> | 2014-10-09 13:56 | Erase | 45 EE
82 | root <root> | 2014-10-09 13:28 | Reinstall | 1
81 | root <root> | 2014-10-09 13:16 | Install | 45
80 | root <root> | 2014-10-09 13:04 | E, I | 9 EE
79 | root <root> | 2014-10-09 13:03 | E, I | 27 EE
78 | root <root> | 2014-10-08 19:02 | Install | 1 <
77 | root <root> | 2014-10-06 16:30 | Update | 2 >
76 | root <root> | 2014-10-01 16:00 | Update | 12 EE
75 | root <root> | 2014-09-26 18:10 | Update | 8
74 | root <root> | 2014-09-25 16:08 | Update | 1
73 | root <root> | 2014-09-17 10:46 | Update | 5
72 | root <root> | 2014-09-11 20:34 | Update | 2
71 | root <root> | 2014-09-05 14:32 | Update | 1
70 | root <root> | 2014-09-04 11:28 | Update | 2
69 | root <root> | 2014-08-31 14:10 | Update | 6
68 | root <root> | 2014-08-27 20:09 | Update | 3
67 | root <root> | 2014-08-22 11:08 | Install | 2
66 | root <root> | 2014-08-22 10:55 | Erase | 1 EE
65 | root <root> | 2014-08-20 16:29 | Update | 1
history list
[root@vps ~]# |
[root@vps ~]# yum history list
Loaded plugins: fastestmirror, presto, replace
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
84 | root <root> | 2014-10-09 14:32 | Install | 45
83 | root <root> | 2014-10-09 13:56 | Erase | 45 EE
82 | root <root> | 2014-10-09 13:28 | Reinstall | 1
81 | root <root> | 2014-10-09 13:16 | Install | 45
80 | root <root> | 2014-10-09 13:04 | E, I | 9 EE
79 | root <root> | 2014-10-09 13:03 | E, I | 27 EE
78 | root <root> | 2014-10-08 19:02 | Install | 1 <
77 | root <root> | 2014-10-06 16:30 | Update | 2 >
76 | root <root> | 2014-10-01 16:00 | Update | 12 EE
75 | root <root> | 2014-09-26 18:10 | Update | 8
74 | root <root> | 2014-09-25 16:08 | Update | 1
73 | root <root> | 2014-09-17 10:46 | Update | 5
72 | root <root> | 2014-09-11 20:34 | Update | 2
71 | root <root> | 2014-09-05 14:32 | Update | 1
70 | root <root> | 2014-09-04 11:28 | Update | 2
69 | root <root> | 2014-08-31 14:10 | Update | 6
68 | root <root> | 2014-08-27 20:09 | Update | 3
67 | root <root> | 2014-08-22 11:08 | Install | 2
66 | root <root> | 2014-08-22 10:55 | Erase | 1 EE
65 | root <root> | 2014-08-20 16:29 | Update | 1
history list
[root@vps ~]#
Jak widać wyświetla historię naszych instalacji, aktualizacji itp.
Żeby sprawdzić „w którym ID” jest nasz paczka, której chcemy się pozbyć, wykonujemy:
yum history list NAZWA #gdzie nazwa to nasz paczka, np. finch |
yum history list NAZWA #gdzie nazwa to nasz paczka, np. finch
[root@vps ~]# yum history list finch
Loaded plugins: fastestmirror, presto, replace
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
84 | root <root> | 2014-10-09 14:32 | Install | 45
83 | root <root> | 2014-10-09 13:56 | Erase | 45 EE
81 | root <root> | 2014-10-09 13:16 | Install | 45
history list
[root@vps ~]# |
[root@vps ~]# yum history list finch
Loaded plugins: fastestmirror, presto, replace
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
84 | root <root> | 2014-10-09 14:32 | Install | 45
83 | root <root> | 2014-10-09 13:56 | Erase | 45 EE
81 | root <root> | 2014-10-09 13:16 | Install | 45
history list
[root@vps ~]#
Podgląd konkretnej historii
Jest możliwość podejrzenia, co zostało zainstalowane w konkretnym ID historii.
yum history info ID #gdzie ID to numer z listy, np. 84 |
yum history info ID #gdzie ID to numer z listy, np. 84
[root@vps ~]# yum history info 84
Loaded plugins: fastestmirror, presto, replace
Transaction ID : 84
Begin time : Thu Oct 9 14:32:48 2014
Begin rpmdb : 385:54ade5a501af0fce0b82ebc04ecbb39bb49b33ad
End time : 14:33:37 2014 (49 seconds)
End rpmdb : 430:c191576f874defa32bebbdc782fbe8cfc15e0661
User : root <root>
Return-Code : Success
Command Line : install finch
Transaction performed with:
[...]
history info
[root@vps ~]# |
[root@vps ~]# yum history info 84
Loaded plugins: fastestmirror, presto, replace
Transaction ID : 84
Begin time : Thu Oct 9 14:32:48 2014
Begin rpmdb : 385:54ade5a501af0fce0b82ebc04ecbb39bb49b33ad
End time : 14:33:37 2014 (49 seconds)
End rpmdb : 430:c191576f874defa32bebbdc782fbe8cfc15e0661
User : root <root>
Return-Code : Success
Command Line : install finch
Transaction performed with:
[...]
history info
[root@vps ~]#
Podsumowanie historii
[root@vps ~]# yum history summary
Loaded plugins: fastestmirror, presto, replace
Login user | Time | Action(s) | Altered
-------------------------------------------------------------------------------
root <root> | Last day | E, I, R | 173
root <root> | Last week | Update | 2
root <root> | Last 2 weeks | Update | 21
root <root> | Last 3 months | E, I, R, U | 85
System <unset> | Last 6 months | Install | 1
root <root> | Last 6 months | E, I, U | 261
history summary
[root@vps ~]# |
[root@vps ~]# yum history summary
Loaded plugins: fastestmirror, presto, replace
Login user | Time | Action(s) | Altered
-------------------------------------------------------------------------------
root <root> | Last day | E, I, R | 173
root <root> | Last week | Update | 2
root <root> | Last 2 weeks | Update | 21
root <root> | Last 3 months | E, I, R, U | 85
System <unset> | Last 6 months | Install | 1
root <root> | Last 6 months | E, I, U | 261
history summary
[root@vps ~]#
Cofanie wprowadzonych zmian/usuwanie paczek
Można cofnąć zmiany w historii, np. usunąć zainstalowane paczki i zależności.
yum history undo ID #gdzie ID to numer operacji, którą chcemy cofnąć |
yum history undo ID #gdzie ID to numer operacji, którą chcemy cofnąć
[root@vps ~]# yum history undo 84
Loaded plugins: fastestmirror, presto, replace
Loading mirror speeds from cached hostfile
* Webmin: webmin.mirror.somersettechsolutions.co.uk
* base: mirror.maeh.org
* centosplus: mirror.maeh.org
* contrib: centos.mirrors.as250.net
* epel: ftp.uni-koeln.de
* epel-debuginfo: ftp.uni-koeln.de
* epel-source: ftp.uni-koeln.de
* epel-testing: mirror.23media.de
* epel-testing-debuginfo: mirror.23media.de
* epel-testing-source: ftp.uni-koeln.de
* extras: mirror.23media.de
* ius: mirror.amsiohosting.net
* rpmforge: mirror.de.leaseweb.net
* rpmforge-extras: mirror.de.leaseweb.net
* rpmforge-testing: mirror.de.leaseweb.net
* updates: mirror.netcologne.de
Undoing transaction 84, from Thu Oct 9 14:32:48 2014
[...]
Resolving Dependencies
--> Running transaction check
[...]
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================================
Removing:
[...]
Transaction Summary
===================================================================================================================================================================================================
Remove 45 Package(s)
Installed size: 67 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
[...]
Removed:
[...]
Complete!
[root@vps ~]# |
[root@vps ~]# yum history undo 84
Loaded plugins: fastestmirror, presto, replace
Loading mirror speeds from cached hostfile
* Webmin: webmin.mirror.somersettechsolutions.co.uk
* base: mirror.maeh.org
* centosplus: mirror.maeh.org
* contrib: centos.mirrors.as250.net
* epel: ftp.uni-koeln.de
* epel-debuginfo: ftp.uni-koeln.de
* epel-source: ftp.uni-koeln.de
* epel-testing: mirror.23media.de
* epel-testing-debuginfo: mirror.23media.de
* epel-testing-source: ftp.uni-koeln.de
* extras: mirror.23media.de
* ius: mirror.amsiohosting.net
* rpmforge: mirror.de.leaseweb.net
* rpmforge-extras: mirror.de.leaseweb.net
* rpmforge-testing: mirror.de.leaseweb.net
* updates: mirror.netcologne.de
Undoing transaction 84, from Thu Oct 9 14:32:48 2014
[...]
Resolving Dependencies
--> Running transaction check
[...]
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================================
Removing:
[...]
Transaction Summary
===================================================================================================================================================================================================
Remove 45 Package(s)
Installed size: 67 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
[...]
Removed:
[...]
Complete!
[root@vps ~]#
Powtarzanie operacji
Da się również przywrócić zainstalowane wcześniej paczki lub konkretną operację z historii.
yum history repeat ID #gdzie ID to nr operacji, którą chcemy powtórzyć, np. 84 |
yum history repeat ID #gdzie ID to nr operacji, którą chcemy powtórzyć, np. 84