centos編譯升級(jí)內(nèi)核

注意:保持/磁盤空間>10G
  • 1.安裝依賴:
yum install -y flex bison bc gcc gcc-c++ make ncurses-devel openssl-devel elfutils-libelf-devel
  • 2.下載所需版本內(nèi)核

https://www.kernel.org/

  • 3.解壓內(nèi)核到/usr/src/kernels/
tar -xf linux-5.3.8.tar.xz -C /usr/src/kernels/
  • 4.設(shè)置編譯參數(shù)(進(jìn)入解壓內(nèi)核目錄)
make menuconfig #進(jìn)入可視化配置 
         allyesconfig #全部功能開啟 
         allnoconfig #最基本參數(shù),可能無(wú)法啟動(dòng)

建議:或者使用當(dāng)前內(nèi)核參數(shù)(先找到當(dāng)前內(nèi)核版本),然后新增功能

cp /boot/config-3.10.0-957.el7.x86_64 /usr/src/kernels/linux-5.3.8/.config
  • 5.編譯(很久,如果多核建議-j核數(shù))
make all
  • 6.安裝
make modules_install #模塊安裝 
make install
  • 7.設(shè)置默認(rèn)的內(nèi)核啟動(dòng)

查看當(dāng)前所有g(shù)rub內(nèi)核

[root@localhost ~]# grep ^menu /boot/grub2/grub.cfg 
menuentry 'CentOS Linux (5.3.8) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-05f0c1f9-bccb-4360-a10e-e1a2edbd96f8' { 
menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-05f0c1f9-bccb-4360-a10e-e1a2edbd96f8' { 
menuentry 'CentOS Linux (0-rescue-61f58926d3fc4d179772b874c54a4ac5) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-61f58926d3fc4d179772b874c54a4ac5-advanced-05f0c1f9-bccb-4360-a10e-e1a2edbd96f8' {

設(shè)置默認(rèn)內(nèi)核

#數(shù)字 0 1 2..... 依次是上面過(guò)濾出來(lái)的順序 
grub2-set-default 0

查看當(dāng)前啟動(dòng)內(nèi)核

[root@localhost ~]# grub2-editenv list saved_entry=0
  • 8.重啟驗(yàn)證內(nèi)核
[root@localhost ~]# uname -r 5.3.8

我的技術(shù)站
https://www.iyunw.cn/

u=2340320312,2290703801&fm=26&gp=0.jpg

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容