mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
translate done: 20170828 How To Use YUM History Command To Rollback An Updates In RHEL-CentOS Systems.md
This commit is contained in:
parent
f0a36e4029
commit
86506ae312
@ -1,28 +1,26 @@
|
|||||||
translating by lujun9972
|
在 RHEL/CentOS 系统上使用 YUM History 命令回滚升级操作
|
||||||
How To Use YUM History Command To Rollback An Updates In RHEL/CentOS Systems
|
|
||||||
======
|
======
|
||||||
Server patching is one of the important task of Linux system administrator to make the system more stable and better performance. All the vendors used to release security/vulnerabilities patches very often, the affected package must be updated in order to limit any potential security risks.
|
为服务器打补丁是 Linux 系统管理员的一项重要任务,为的是让系统更加稳定,性能更加优化。厂商经常会发布一些安全/高危的补丁包,相关软件需要升级以防范潜在的安全风险。
|
||||||
|
|
||||||
Yum (Yellowdog Update Modified) is RPM Package Management utility for CentOS and Red Hat systems, Yum history command allows administrator to rollback the system to a previous state but due to some limitations, rollbacks do not work in all situations, or The yum command may simply do nothing, or it may remove packages you do not expect.
|
Yum (Yellowdog Update Modified) 是 CentOS 和 RedHat 系统上用的 RPM 包管理工具,Yum history 命令允许系统管理员将系统回滚到上一个状态,但由于某些限制,回滚不是在所有情况下都能成功,有时 yum 命令可能什么都不做,有时可能会删掉一些其他的包。
|
||||||
|
|
||||||
I advise you to take a full system backup prior to performing any update/upgrade is always recommended, and yum history is NOT meant to replace systems backups. This will help you to restore the system to previous state at any point of time.
|
我建议你在升级之前还是要做一个完整的系统备份,而 yum history 并不能用来替代系统备份的。系统备份能让你将系统还原到任意时候的节点状态。
|
||||||
|
|
||||||
**Suggested Read :**
|
**推荐阅读:**
|
||||||
**(#)** [YUM Command To Manage Packages on RHEL/CentOS Systems][1]
|
**(#)** [在 RHEL/CentOS 系统上使用 YUM 命令管理软件包 ][1]
|
||||||
**(#)** [DNF (Fork of YUM) Command To Manage Packages on Fedora System][2]
|
**(#)** [在 Fedora 系统上使用 DNF (YUM 的一个分支) 命令管理软件包 ][2]
|
||||||
**(#)** [How To Display Date And Time In History Command][3]
|
**(#)** [如何让 History 命令显示日期和时间 ][3]
|
||||||
|
|
||||||
In some cases, the hosted applications might not work properly or through some error due to recent patch updates (It could be some library incompatibility or package upgrade), what will be the solution in this case?
|
某些情况下,安装的应用程序在升级了补丁之后不能正常工作或者出现一些错误(可能是由于库不兼容或者软件包升级导致的),那该怎么办呢?
|
||||||
|
|
||||||
Get in touch with App Dev team and figure it out an issue creating library's and packages then do the rollback with help of yum history command.
|
与应用开发团队沟通,并找出导致库和软件包的问题所在,然后使用 yum history 命令进行回滚。
|
||||||
**Note :**
|
**注意:**
|
||||||
|
|
||||||
* Rollback of selinux, selinux-policy-*, kernel, glibc (dependencies of glibc such as gcc) packages to older version is not supported.
|
* 它不支持回滚 selinux,selinux-policy-*,kernel,glibc (以及依赖 glibc 的包,比如 gcc)。
|
||||||
* Downgrading a system to minor version is not recommended (CentOS 6.9 to CentOS 6.8) which leads to make the system in undesired state
|
* 不建议将系统降级到更低的版本(比如 CentOS 6.9 降到 CentOS 6.8),这回导致系统处于不稳定的状态
|
||||||
|
|
||||||
|
让我们先来看看系统上有哪些包可以升级,然后挑选出一些包来做实验。
|
||||||
|
|
||||||
|
|
||||||
Let's first verify an available updates on system and pick any of the package for this experiment.
|
|
||||||
```
|
```
|
||||||
# yum update
|
# yum update
|
||||||
Loaded plugins: fastestmirror, security
|
Loaded plugins: fastestmirror, security
|
||||||
@ -71,7 +69,7 @@ Is this ok [y/N]: n
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
As you can see in the above output `git` package update is available, so we are going to take that. Run the following command to know the version information about the package (current installed version and available update version).
|
你会发现 `git` 包可以被升级,那我们就用它来实验吧。运行下面命令获得软件包的版本信息(当前安装的版本和可以升级的版本)。
|
||||||
```
|
```
|
||||||
# yum list git
|
# yum list git
|
||||||
Loaded plugins: fastestmirror, security
|
Loaded plugins: fastestmirror, security
|
||||||
@ -85,7 +83,7 @@ git.x86_64 1.7.1-9.el6_9 updates
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the following command to update `git` package from `1.7.1-8` to `1.7.1-9`.
|
运行下面命令来将 `git` 从 `1.7.1-8` 升级到 `1.7.1-9`。
|
||||||
```
|
```
|
||||||
# yum update git
|
# yum update git
|
||||||
Loaded plugins: fastestmirror, presto
|
Loaded plugins: fastestmirror, presto
|
||||||
@ -152,7 +150,7 @@ Complete!
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Verify updated version of `git` package.
|
验证升级后的 `git` 版本.
|
||||||
```
|
```
|
||||||
# yum list git
|
# yum list git
|
||||||
Installed Packages
|
Installed Packages
|
||||||
@ -164,9 +162,9 @@ git-1.7.1-9.el6_9.x86_64
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
As of now, we have successfully completed package update and got a package for rollback. Just follow below steps for rollback mechanism.
|
现在我们成功升级这个软件包,可以对它进行回滚了. 步骤如下.
|
||||||
|
|
||||||
First get the yum transaction id using following command. The below output clearly shows all the required information such transaction id, who done the transaction (i mean username), date and time, Actions (Install or update), how many packages altered in this transaction.
|
首先,使用下面命令获取yum操作id. 下面的输出很清晰地列出了所有需要的信息,例如操作 id, 谁做的这个操作(用户名), 操作日期和时间, 操作的动作(安装还是升级), 操作影响的包数量.
|
||||||
```
|
```
|
||||||
# yum history
|
# yum history
|
||||||
or
|
or
|
||||||
@ -190,7 +188,7 @@ ID | Login user | Date and time | Action(s) | Altered
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command shows two packages has been altered because git updated it's dependence package too **perl-Git**. Run the following command to view detailed information about the transaction.
|
上面命令现实有两个包受到了影响,因为 git 还升级了它的依赖包 **perl-Git**. 运行下面命令来查看关于操作的详细信息.
|
||||||
```
|
```
|
||||||
# yum history info 13
|
# yum history info 13
|
||||||
Loaded plugins: fastestmirror, presto
|
Loaded plugins: fastestmirror, presto
|
||||||
@ -216,7 +214,7 @@ history info
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Fire the following command to Rollback the `git` package to the previous version.
|
运行下面命令来回滚 `git` 包到上一个版本.
|
||||||
```
|
```
|
||||||
# yum history undo 13
|
# yum history undo 13
|
||||||
Loaded plugins: fastestmirror, presto
|
Loaded plugins: fastestmirror, presto
|
||||||
@ -284,7 +282,7 @@ Complete!
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
After rollback, use the following command to re-check the downgraded package version.
|
回滚后, 使用下面命令来检查降级包的版本.
|
||||||
```
|
```
|
||||||
# yum list git
|
# yum list git
|
||||||
or
|
or
|
||||||
@ -293,9 +291,9 @@ git-1.7.1-8.el6.x86_64
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rollback Updates using YUM downgrade command
|
### 使用YUM downgrade 命令回滚升级
|
||||||
|
|
||||||
Alternatively we can rollback an updates using YUM downgrade command.
|
此外,我们也可以使用 YUM downgrade 命令回滚升级.
|
||||||
```
|
```
|
||||||
# yum downgrade git-1.7.1-8.el6 perl-Git-1.7.1-8.el6
|
# yum downgrade git-1.7.1-8.el6 perl-Git-1.7.1-8.el6
|
||||||
Loaded plugins: search-disabled-repos, security, ulninfo
|
Loaded plugins: search-disabled-repos, security, ulninfo
|
||||||
@ -351,11 +349,11 @@ Complete!
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note :** You have to downgrade a dependence packages too, otherwise this will remove the current version of dependency packages instead of downgrade because the downgrade command cannot satisfy the dependency.
|
**注意 :** 你也需要降级依赖包, 否则它会删掉当前版本的依赖包而不是对依赖包做降级,因为downgrade命令无法处理依赖关系.
|
||||||
|
|
||||||
### For Fedora Users
|
### 至于 Fedora 用户
|
||||||
|
|
||||||
Use the same above commands and change the package manager command to DNF instead of YUM.
|
命令是一样的,只需要将包管理器名称从YUM改成DNF就行了.
|
||||||
```
|
```
|
||||||
# dnf list git
|
# dnf list git
|
||||||
# dnf history
|
# dnf history
|
||||||
@ -370,13 +368,13 @@ Use the same above commands and change the package manager command to DNF instea
|
|||||||
|
|
||||||
via: https://www.2daygeek.com/rollback-fallback-updates-downgrade-packages-centos-rhel-fedora/
|
via: https://www.2daygeek.com/rollback-fallback-updates-downgrade-packages-centos-rhel-fedora/
|
||||||
|
|
||||||
作者:[][a]
|
作者:[2daygeek][a]
|
||||||
译者:[lujun9972](https://github.com/lujun9972)
|
译者:[lujun9972](https://github.com/lujun9972)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
[a]:https://www.2daygeek.com
|
[a]:https://www.2daygeek.com/author/2daygeek/
|
||||||
[1]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
[1]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
||||||
[2]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
|
[2]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
|
||||||
[3]:https://www.2daygeek.com/display-date-time-linux-bash-history-command/
|
[3]:https://www.2daygeek.com/display-date-time-linux-bash-history-command/
|
Loading…
Reference in New Issue
Block a user