手机看片精品高清国产日韩,色先锋资源综合网,国产哺乳奶水91在线播放,乱伦小说亚洲色图欧洲电影

幫助中心 >  行業(yè)資訊 >  云計算 >  centos7停止維護后,怎么升級內(nèi)核

centos7停止維護后,怎么升級內(nèi)核

2025-01-16 11:27:59 3124

在使用 CentOS 的過程中,常常會面臨各種挑戰(zhàn),其中一個重要的方面就是內(nèi)核的升級問題。隨著應(yīng)用環(huán)境的不斷發(fā)展,高版本的應(yīng)用對內(nèi)核的要求也日益提高,因此內(nèi)核升級變得不可或缺。然而,當(dāng) CentOS 7 停止維護后,內(nèi)核的升級過程就不再像以往那樣簡單,會遇到諸多新情況。


但是在 centos 7 停止維護之后,無法使用 yum 直接升級內(nèi)核,執(zhí)行下面的命令時,已經(jīng)不顯示內(nèi)核版本了。


[root@k8s-master01 ~]# yum list available --disablerepo=* --enablerepo=elrepo-kernel
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * elrepo-kerne
 l: mirrors.tuna.tsing
 hua.edu.cn
 elrepo-kernel                                                   | 3.0 kB  00:00:00                                                                                                                                           
 elrepo-kernel/primary_db                                            | 2.2 kB  00:00:00    
 Available Packageselrepo-release.noarch        7.0-8.el7.elrepo       elrepo-kernel


關(guān)于內(nèi)核種類:


    kernel-ml :ml = mainline,主流版本

    kernel-lt :lt = long-term ,長期有效


ML 與 LT 兩種內(nèi)核類型版本可以共存,但每種類型內(nèi)核只能存在一個版本。

kernel rpm 歷史版本:

image.png

導(dǎo)入公鑰

image.pngimage.png

查看內(nèi)核版本

[root@k8s-master01 ~]# uname -r
3.10.0-1160.119.1.el7.x86_64

開始安裝新版本的內(nèi)核

[root@k8s-master01 ~]# rpm -ih kernel-ml-6.9.7-1.el7.elrepo.x86_64.rpm
################################# [100%]
Updating / installing...
################################# [100%]
[root@k8s-master01 ~]# rpm -ih kernel-ml-devel-6.9.7-1.el7.elrepo.x86_64.rpm
################################# [100%]
Updating / installing...
################################# [100%]
[root@k8s-master01 ~]# rpm -ih kernel-ml-headers-6.9.7-1.el7.elrepo.x86_64.rpm
 error: Failed dependencies:
       kernel-headers < 6.9.7-1.el7.elrepo conflicts with kernel-ml-headers-6.9.7-1.el7.elrepo.x86_64


kernel-ml-headers 安裝時提示沖突報錯

要解決這個問題,需要先重啟到最新的內(nèi)核,然后卸載舊內(nèi)核,再次安裝即可。


查看已安裝的內(nèi)核版本:


[root@k8s-master01 ~]# awk -F\\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux 7 Rescue c699e4abb55f41d2894c5e5d076ece00 (6.9.7-1.el7.elrepo.x86_64)
1 : CentOS Linux (6.9.7-1.el7.elrepo.x86_64) 7 (Core)
2 : CentOS Linux 7 Rescue 3708a8c5ffaf41ec8c2b6c256447b9d3 (3.10.0-1160.119.1.el7.x86_64)
3 : CentOS Linux (3.10.0-1160.119.1.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-e824c70f6df443479545152398478c6f) 7 (Core)


可以看到最新安裝的內(nèi)核是 0 ,所以需要將最新內(nèi)核 0 設(shè)置為默認引導(dǎo)。

[root@k8s-master01 ~]# grub2-set-default 0


生成 grub配置文件

[root@k8s-master01 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.9.7-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-6.9.7-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.119.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.119.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-3708a8c5ffaf41ec8c2b6c256447b9d3
Found initrd image: /boot/initramfs-0-rescue-3708a8c5ffaf41ec8c2b6c256447b9d3.img
Found linux image: /boot/vmlinuz-0-rescue-5ea3132971dd43e59cf37c5576c6ec0e
Found initrd image: /boot/initramfs-0-rescue-5ea3132971dd43e59cf37c5576c6ec0e.img
Found linux image: /boot/vmlinuz-0-rescue-e824c70f6df443479545152398478c6f
Found initrd image: /boot/initramfs-0-rescue-e824c70f6df443479545152398478c6f.img
done


重啟服務(wù)器

[root@k8s-master01 ~]# reboot


最后再安裝 kernel-ml-headers

[root@k8s-master01 ~]# rpm -ih kernel-ml-headers-6.9.7-1.el7.elrepo.x86_64.rpm################################# [100%]Updating / installing...################################# [100%]


查看當(dāng)前的內(nèi)核版本

[root@k8s-master01 ~]# uname -r6.9.7-1.el7.elrepo.x86_64


通過以上一系列操作,我們成功解決了 CentOS 7 停止維護后內(nèi)核升級的問題。盡管過程中遇到了諸如 kernel-ml-headers 安裝沖突等困難,但最終還是實現(xiàn)了內(nèi)核的順利更新,為我們在更高版本應(yīng)用環(huán)境下的使用提供了保障。


想了解更多CentOS相關(guān)的分享歡迎上藍隊云官網(wǎng)查詢,更多免費技術(shù)學(xué)習(xí)文檔,藍隊云期待與您一起探索。

提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進一步的反饋信息:

在文檔使用中是否遇到以下問題: