如何更新/升级Red Hat Enterprise Linux内核?

环境

  • 红帽企业Linux 3
  • 红帽企业Linux 4
  • 红帽企业Linux 5
  • 红帽企业Linux 6
  • 红帽企业Linux 7

问题

  • 如何更新Red Hat Enterprise Linux内核?
  • 如何在Red Hat Enterprise Linux上更新内核,有什么需要特别关注的吗?
  • 如何安装更新的内核?

决议

Red Hat does not recommend using update option to update the kernel. Rather we suggest install which allows us to preserve the old kernel to boot from should we run into issues on the newer kernel.

Red Hat建议不要使用update选项来更新内核。相反,我们建议install哪个允许我们保留旧内核来启动,如果我们遇到新内核的问题。

  • Get the kernel package, required kernel type can be downloaded from the Red Hat Customer Portal. In RHEL4 you can choose a normal kernel, kernel-smp, kernel-largesmp, kernel-hugemem. In RHEL5, you can choose a normal kernel, kernel-PAE and kernel-xen.
  • Install kernel package
  • Note: Again, never use "rpm -Uvh" here. To leave an old version just in case.
  • 获取内核包,可以从Red Hat Customer Portal下载所需的内核类型在RHEL4中,您可以选择普通内核,kernel-smp,kernel-largesmp,kernel-hugemem。在RHEL5中,您可以选择普通内核,kernel-PAE和kernel-xen。
  • 安装内核包
  • 注意:再次,永远不要在这里使用“rpm -Uvh”保留旧版本以防万一。
    # rpm -ivh kernel-<version>.rpm
    
    • 如果您已将系统注册到RHN或RHSM,并且您的系统是Red Hat Enterprise Linux 6,请运行以下命令:
      # yum install kernel
      
    • 如果您已将系统注册到RHN或RHSM,并且您的系统是Red Hat Enterprise Linux 5,请运行以下命令:
      # yum install kernel
      
    • 如果您已将系统注册到RHN或RHSM,并且您的系统是Red Hat Enterprise Linux 3或4,请运行以下命令:
      # up2date kernel
      
    • If your system is IA32 or x86_64 architecture, edit the /boot/grub/grub.conf.  You will find a new kernel section is appended to this file after you install the new kernel.  Find the "default" field, make sure it points to the right kernel you want to boot. You can modify the value of "default", just remember this value is counted from "0" which means the "0" is the first kernel, the "1" is the second kernel.
    • If your old system has installed some third party drivers, these drivers will not be included in new kernel, you need to reinstall all the third party drivers and corresponding initrd
    • Normally, only the new kernel package is needed, but sometimes the new kernel need install or upgrade other packages first (dependency problem), such as kernel-devel, kernel-headers, ecryptfs-utils, mkinitrd, etc.
    • If your old system has installed kernel-devel and kernel-headers package, and if you want to keep the kernel-devel package consistent with the new kernel, you can update the kernel-devel with command "rpm -Uvh", just remember that after you update it, it might not be easy to get it back to the old version, and some of your development applications might be affected.
    • If you need to update packages using rpm, not yum/up2date. You need to download packages and confirm dependency manually. Generally, Red Hat Support doesn't assure you to provide lists of all package you need to download. It is because it depend on each systems. It's not only kernel package but also all 'manual update using rpm utility'.
    • Backup important data and get ready for rebooting operation system.
    • Additional for RHEL6, kernel-firmware is depended by kernel.
  • 如果您的系统是IA32或x86_64体系结构,请编辑/boot/grub/grub.conf。安装新内核后,您会发现新的内核部分会附加到此文件中。找到“默认”字段,确保它指向您要引导的正确内核。你可以修改“default”的值,只记得这个值从“0”开始计数,这意味着“0”是第一个内核,“1”是第二个内核。
  • 如果您的旧系统安装了一些第三方驱动程序,这些驱动程序将不会包含在新内核中,您需要重新安装所有第三方驱动程序和相应的initrd
  • 通常,只需要新的内核包,但有时新内核需要首先安装或升级其他包(依赖性问题),例如kernel-devel,kernel-headers,ecryptfs-utils,mkinitrd等。
  • 如果你的旧系统安装了kernel-devel和kernel-headers包,并且你想让kernel-devel包与新内核保持一致,你可以使用命令“rpm -Uvh”更新kernel-devel,只需记住更新后,可能不容易将其恢复到旧版本,并且您的某些开发应用程序可能会受到影响。
  • 如果需要使用rpm更新软件包,而不是yum / up2date。您需要手动下载包并确认依赖关系。通常,Red Hat Support不保证您提供需要下载的所有软件包的列表。这是因为它取决于每个系统。它不仅是内核包,而且还是“使用rpm实用程序进行手动更新”。
  • 备份重要数据并为重启操作系统做好准备。
  • 对于RHEL6,内核固件依赖于内核。
rpm -ivh kernel-2.6.32-504.el6.x86_64.rpm 
error: Failed dependencies:
    kernel-firmware >= 2.6.32-504.el6 is needed by kernel-2.6.32-504.el6.x86_64
  • 更新内核固件:
 rpm -Uvh kernel-firmware-2.6.32-504.el6.noarch.rpm 
Preparing...                ########################################### [100%]
   1:kernel-firmware        ########################################### [100%]
  • 安装新内核:
rpm -ivh kernel-2.6.32-504.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:kernel                 ########################################### [100%]
# rpm -ivh kernel-3.10.0-229.20.1.el7.x86_64.rpm
error: Failed dependencies:
    dracut >= 033-241.el7_1.5 is needed by kernel-3.10.0-229.20.1.el7.x86_64    

# rpm -Uvh dracut-033-241.el7_1.5.x86_64.rpm  
error: Failed dependencies:
    dracut = 033-240.el7 is needed by (installed) dracut-network-033-240.el7.x86_64
    dracut = 033-240.el7 is needed by (installed) dracut-config-rescue-033-240.el7.x86_64
  • 首先更新dracut,dracut-network和dracut-config-rescue:
# rpm -Uvh dracut-033-241.el7_1.5.x86_64.rpm dracut-config-rescue-033-241.el7_1.5.x86_64.rpm dracut-network 033-241.el7_1.5.x86_64.rpm

Preparing...                          ################################# [100%]
Updating / installing...
   1:dracut-033-241.el7_1.5           ################################# [ 17%]
   2:dracut-config-rescue-033-241.el7_################################# [ 33%]
   3:dracut-network-033-241.el7_1.5   ################################# [ 50%]
Cleaning up / removing...
   4:dracut-network-033-240.el7       ################################# [ 67%]
   5:dracut-config-rescue-033-240.el7 ################################# [ 83%]
   6:dracut-033-240.el7               ################################# [100%]
  • 然后安装新内核:
# rpm -ivh kernel-3.10.0-229.20.1.el7.x86_64.rpm
Preparing...         
Updating / installing...
   1:kernel-3.10.0-229.20.1.el7       ################################# [100%]

猜你喜欢

转载自www.cnblogs.com/augusite/p/11263888.html