通过 man yum 的帮助信息了解 yum update 和 yum upgrade:

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 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 与 update --obsoletes 是一样的

  然而,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=19&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

  就是说默认情况下 update 和 upgrade 没有区别,都是将系统包更新到最新的版本并且强制删除过时的老版本,并且都会升级内核版本,这种更新操作是危险的,因为可能有些运行中的服务仍旧依赖着旧版本。

  因此我们可以修改默认配置,sed -i 's/obsoletes=1/obsoletes=0/' /etc/yum.conf,从而使update在进行系统包更新时保留旧版本。

  如果我们不想升级内核版本,还需要添加 echo exclude=kernel* >> /etc/yum.conf。

  参考:

  https://unix.stackexchange.com/questions/55777/in-centos-what-is-the-difference-between-yum-update-and-yum-upgrade

  https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sec-configuring_yum_and_yum_repositories

CentOS中的 yum upgrade 和 yum update 的区别的更多相关文章

  1. Linux中升级更新命令yum upgrade和yum update的区别

    区别 Linux升级命令有两个分别是yum upgrade和yum update, 这个两个命令是有区别的: 代码如下: yum -y update #升级所有包,同时也升级软件和系统内核 yum - ...

  2. yum upgrade和yum update的区别

    Linux升级命令有两个分别是yum upgrade和yum update, 这个两个命令是有区别的: yum -y update 升级所有包同时也升级软件.系统版本和系统内核 yum -y upgr ...

  3. Linux升级命令yum upgrade和yum update的区别

    Linux升级命令有两个分别是yum upgrade和yum update, 这个两个命令是有区别的: yum -y update 升级所有包同时也升级软件和系统内核 yum -y upgrade 只 ...

  4. CentOS下的yum upgrade和yum update区别

    说明:生产环境对软件版本和内核版本要求非常精确,别没事有事随便的进行yum update操作!! ! yum update:升级所有包同时也升级软件和系统内核 yum upgrade:只升级所有包,不 ...

  5. CentOS下的yum upgrade和yum update区别,没事别乱用,和Ubuntu的update不一样!

    说明:生产环境对软件版本和内核版本要求非常精确,别没事有事随便的进行yum update操作!!!!!!!!! yum update:升级所有包同时也升级软件和系统内核 yum upgrade:只升级 ...

  6. centos中python2.7被覆盖,yum,python重新安装

    参考如下,问题以解决,绝对有效 下载链接yum和python2.7网盘 链接:https://pan.baidu.com/s/1sC2crFW1I8F7zndJU0jjcA 提取码:5kia 直接参考 ...

  7. Centos下yum update与yum upgrade的区别

    转载来源于:http://www.cnblogs.com/EasonJim/p/9026357.html 说明:生产环境对软件版本和内核版本要求非常精确,别没事有事随便的进行yum update操作! ...

  8. ubuntu中apt使用以及centos中yum的使用

    centos和ubuntu是两大linux主流阵营 在centos中下载安装软件的方式 rpm rpm命令是RPM软件包的管理工具.rpm原本是Red Hat Linux发行版专门用来管理Linux各 ...

  9. <亲测>CentOS中yum安装ffmpeg

    CentOS中yum安装ffmpeg 1.升级系统 sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now 2 ...

随机推荐

  1. GDAL安装和使用

    1.安装 下载源程序包 ,解压,运行以下三条命令 ./configure --prefix=~ make make install

  2. Electron在Windows下的环境搭建

    Electron作为一种用javascript写桌面程序的开发方式,现在已经被大众接受.下面就介绍如何在windows(>win7)下快速搭建Electron开发环境. 1. nodejs 的安 ...

  3. 从数据库读取数据后将其输出成html标签

    最常用的方法,使用JS或JQ JQ: $("#div").html("<span>我是HTML代码</span>"); JS: var ...

  4. msvcr100.dll丢失原因及解决方法

    msvcr100.dll为Visual Studio 2010的一个动态链接库,如果某程序是用它开发出来的,那么该程序的运行就有可能需要此动态链接库.有些程序直接将其打包到了安装目录,并注册,就不会出 ...

  5. with优化妙用

    --语法: /*with   alias_name1 as    (subquery1),  alias_name2 as    (subQuery2),  ……  alias_nameN as   ...

  6. Linux:CentOS7卸载mysql

    步骤 方法一. 1.查看mysql安装 rpm -qa|grep -i mysql 2.卸载前关闭mysql服务 rpm -ev --nodeps mysql-community-release-el ...

  7. 深入编解码:ASCII,UNICODE,UTF8等

    ASCII ASCII = American Standard Code for Information Interchange(美国信息交换标准码) 美国最先有了计算机技术,计算机里面只有01,也就 ...

  8. January 29 2017 Week 5 Sunday

    In order to be irreplaceable one must always be different. 若想无可替代,必须与众不同. If all your skills or pers ...

  9. January 27 2017 Week 4 Friday

    Procrastination is the thief of time. 拖延是时光之贼. Procrastination is the thief of time, besides, it is ...

  10. PTA练习题之7-2 求交错序列前N项和(15 分)

    本题要求编写程序,计算交错序列 1-2/3+3/5-4/7+5/9-6/11+... 的前N项之和. 输入格式: 输入在一行中给出一个正整数N. 输出格式: 在一行中输出部分和的值,结果保留三位小数. ...