yum update 和 upgrade 出现的惨案

yum update 和 upgrade 出现的惨案

    首先记录一下惨案的事故过程

  • 事故原因:首先想安装一个插件,因为此版本yum上无此package,于是想更新一下yum源,执行yum update,因为平时也是如此操作过,无任何问题,但今天出问题了,因为某种问题,导致docker服务全体掉线,重启服务之后发现,docker网络又出现问题,导致服务全体下线。
  • 解决办法:重启docker 容器,使网络恢复,服务恢复正常,也不知道为啥。

  事故产生因为对liunx操作的不谨慎及相关操作原理未深入理解导致

  以下做出相应总结,以儆效尤

yum升级

  Linux yum中package升级命令有两个分别是 yum upgrade 和 yum update 

  首先给出相应的yum对这两个的文档说明

  yum update  

If run without any packages, update will update every currently installed package.  If one or more packages or package globs are specified, Yum will only update the  listed
packages.  While updating packages, yum will ensure that all dependencies are satisfied. (See Specifying package names for more information) If the packages or globs speci-
fied match to packages which are not currently installed then update will not install them. update operates on groups, files, provides and filelists just like the "install"
command.
 
If  the  main  obsoletes configure option is true (default) or the --obsoletes flag is present yum will include package obsoletes in its calculations - this makes it better
for distro-version changes, for example: upgrading from somelinux 8.0 to somelinux 9.
 
Note that "update" works on installed packages first, and only if there are no matches does it look for available packages. The difference is most noticeable  when  you  do
"update foo-1-2" which will act exactly as "update foo" if foo-1-2 is installed. You can use the "update-to" if you’d prefer that nothing happen in the above case.

  yum upgrade

Is the same as the update command with the — obsoletes flag set. See update for more details.

经查阅相关文档及众说纷纭的博客可以得出

  yum update     升级所有包,会保留旧版本的 package,更新系统内核根据 obsoletes 配置而定


 

  yum upgrade   升级所有包,会删除旧版本的 package,更新系统内核


 

    yum 的 upgrade 是等价于打开 obsoletes 配置的 yum update

  而默认中/etc/yum.conf配置文件obsoletes是打开的,因此这两个指令针对系统内核来说是等价的。


 

 

若一定要升级,如果软件依赖旧版本的package,最好是使用 yum update,确保不会出现兼容问题。但再正式环境最好不要使用yum更新,会出现意想不到的问题。一不小心会搞得跟 rm -rf 一样的快感

 

 

 

原文地址:https://www.cnblogs.com/zhouguanglin/p/13218946.html