CentOS 中 yum update 与 yum upgrade 的区别

在 CentOS 系统中,yum upgradeyum update 都会将系统包更新到最新版本。

至于区别,我们还是通过 man 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 infor‐
              mation) If the packages or globs specified 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.

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

根据帮助信息可以看到,upgrade 与附带 --obsoletes 的选项时的 update 是一样的

重要说明如下:

upgrade:

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

update:

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.

然而, update 即使不附带 --obsoletes 选项时,默认的配置中将其设置为了 true (开启),在 /etc/yum.conf 文件中可以查看到默认的配置信息:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

所以,只能说默认情况下没有区别,而使用 update 则更为灵活。

参考:
in-centos-what-is-the-difference-between-yum-update-and-yum-upgrade
CONFIGURING YUM AND YUM REPOSITORIES

推荐阅读更多精彩内容

  • http://blog.csdn.net/mathewsking/article/details/8211273 ...
    liuboxx1阅读 2,497评论 1 0
  • yum 的宗旨是自动化地升级,安装/移除rpm 包,收集rpm 包的相关信息,检查依赖性并自动提示用户解决。yum...
    依忆依意壹懿阅读 1,058评论 0 4
  • 【Linux软件安装管理系列】— — 传送门: — —《Linux软件安装管理之——源码安装详解》 — —《Lin...
    Nosee123阅读 4,414评论 0 26
  • 俗话说,大学生多如狗,研究生遍地走。当今社会,工作压力越来越大。很多人,开始工作一段时间之后,又回去考研去了。几乎...
    荻花令阅读 172评论 0 0
  • 毕业时,方源回了太源,程芳菲回了天津。这是后话。还是先说说可爱的杨小米吧。 杨小米在家是老小,上面有...
    梅洛的听雨轩阅读 67评论 0 0