在redhat和linux中使用yum回滚更新
不推荐对系统进行小版本降级(如将 RHEL6.1 降到 RHEL6.0),因为在这种降级中,libgcc和其他库不会按预期回滚,系统将处于“broken state”。想要进行少量更新的回滚,可以用yum的history选项。
注意: 回滚 selinux-policy-* 包到老版本是不支持的。
计划进行回滚,而不是重新安装,可以参考下面样例步骤:
screen
这个包的示例:[root@localhost ~]# yum install screen
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
rhel-6-server-rpms | 2.4 kB 00:00
rhel-ha-for-rhel-6-server-rpms | 2.4 kB 00:00
rhel-lb-for-rhel-6-server-rpms | 2.0 kB 00:00
rhel-rs-for-rhel-6-server-rpms | 2.4 kB 00:00
rhel-scalefs-for-rhel-6-server-rpms | 951 B 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package screen.i686 0:4.0.3-16.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================================
Installing:
screen i686 4.0.3-16.el6 rhel-6-server-rpms 484 k
Transaction Summary
======================================================================================================================================================================
Install 1 Package(s)
Total download size: 484 k
Installed size: 484 k
Is this ok [y/N]: y
Downloading Packages:
screen-4.0.3-16.el6.i686.rpm | 484 kB 00:08
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : screen-4.0.3-16.el6.i686 1/1
rhel-6-server-rpms/productid | 1.7 kB 00:00
rhel-ha-for-rhel-6-server-rpms/productid | 1.7 kB 00:00
rhel-lb-for-rhel-6-server-rpms/productid | 1.7 kB 00:00
rhel-rs-for-rhel-6-server-rpms/productid | 1.7 kB 00:00
duration: 319(ms)
Installed products updated.
Installed:
screen.i686 0:4.0.3-16.el6
Complete!
[root@localhost ~]# yum history
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
8 | root | 2011-10-03 14:40 | Install | 1
7 | root | 2011-09-21 04:24 | Install | 1 ##
6 | root | 2011-09-21 04:23 | Install | 1 ##
5 | root | 2011-09-16 13:35 | Install | 1
4 | root | 2011-09-16 13:33 | Erase | 1
3 | root | 2011-09-14 14:36 | Install | 1
2 | root | 2011-09-12 15:48 | I, U | 80
1 | System | 2011-09-12 14:57 | Install | 1025
[root@localhost ~]# yum history undo 8
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
rhel-6-server-rpms | 2.4 kB 00:00
rhel-ha-for-rhel-6-server-rpms | 2.4 kB 00:00
rhel-lb-for-rhel-6-server-rpms | 2.0 kB 00:00
rhel-rs-for-rhel-6-server-rpms | 2.4 kB 00:00
rhel-scalefs-for-rhel-6-server-rpms | 951 B 00:00
Undoing transaction 8, from Mon Oct 3 14:40:01 2011
Install screen-4.0.3-16.el6.i686
Resolving Dependencies
--> Running transaction check
---> Package screen.i686 0:4.0.3-16.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================================
Removing:
screen i686 4.0.3-16.el6 @rhel-6-server-rpms 783 k
Transaction Summary
======================================================================================================================================================================
Remove 1 Package(s)
Installed size: 783 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : screen-4.0.3-16.el6.i686 1/1
duration: 320(ms)
Installed products updated.
Removed:
screen.i686 0:4.0.3-16.el6
Complete!