如何更新/升級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%]


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM