CentOS使用yum更新系统时不更新内核方法


:Mr.zhou  阅读: 2,287 次

  考虑到操作系统与服务器硬件的兼容性,对内核进行版本升级后可能导致服务器不能正常启动,没有特别的需求,建议不要对内核进行随意升级。

  方法一:使用yum命令进行软件更新时,不进行内核的方法:

[root@server1 ~]# yum --exclude=kernel* update

  方法二:更改yum.conf配置文件内容,在[main]最后添加exclude=kernel*,永久禁止在系统更新时,对内核进行更新:

[root@server1 ~]# vi /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=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
exclude=kernel* (新添加)

  对比测试

[root@server1 ~]# uname -r
2.6.32-431.el6.i686
[root@server1 ~]# yum update
---> Package kernel.i686 0:2.6.32-504.12.2.el6 will be installed
---> Package kernel-firmware.noarch 0:2.6.32-431.el6 will be updated
---> Package kernel-firmware.noarch 0:2.6.32-504.12.2.el6 will be an update
---> Package kernel-headers.i686 0:2.6.32-431.el6 will be updated
---> Package kernel-headers.i686 0:2.6.32-504.12.2.el6 will be an update

 kernel-firmware          noarch 2.6.32-504.12.2.el6              updates  14 M
 kernel-headers           i686   2.6.32-504.12.2.el6              updates 3.3 M

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade     121 Package(s)

Total download size: 140 M
[root@server1 ~]# yum --exclude=kernel* update

Transaction Summary
================================================================================
Upgrade     119 Package(s)

Total download size: 96 M

转载请注明原文链接:http://www.z-dig.com/yum-update-all-packages-except-the-linux-kernel.html



正文部分到此结束