centos核心升級的兩種方法

來源:互聯網
上載者:User

對於一些特殊的軟體,如docker 需要linux核心3.1 之上才能很好支援,這時就需要升級核心了,而centos7預設的核心好像是  3.10.x,有些低。

方法一:

查看當前系統核心版本 uname -r

1. 匯入key

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

2. 安裝 elrepo 的yum源

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

3. 安裝核心

在yum的elrepo源中,有最新版本核心。直接yum安裝即可。

yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y

5. 設定系統啟動順序

查看系統啟動項:

cat /boot/grub2/grub.cfg |grep menuentry

可以發現有最新版本的核心,此時可以設定最新版本核心為預設啟動:

grub2-set-default 'CentOS Linux (4.8.5-1.el7.elrepo.x86_64) 7 (Core)'

此時,查看預設啟動的系統版本grub2-editenv list:

顯示為'CentOS Linux (4.8.5-1.el7.elrepo.x86_64) 7 (Core)'

6. reboot,重啟之後再次查看 uname -r 方法二:

1 下載核心源碼

下載網址為 https://www.kernel.org/

wget xxx

2 解壓並進入源碼目錄

3 更新系統並安裝依賴軟體

#yum update

#yum upgrade

#yum groups install Development Tools

#yum install ncurses-devel qt-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel

4 將當前核心設定檔拷貝到目前的目錄

本來是應該執行make menuconfig來自訂核心配置的,組建組態檔案.config; 但是可以直接使用原來系統的核心配置,也就是拷貝/boot目錄下的設定檔到目前的目錄。

cp /boot/config-2.6.32-431.11.2.el6.x86_64 .config

5 使用當前核心的配置

#sh -c 'yes "" | make oldconfig' #centos 6

#sh -c 'y "" | make oldconfig' #centos 7

6 編譯安裝

#make bzImage

#make modules

#make modules_install

#make install

7 設定系統啟動順序

查看系統啟動項:

cat /boot/grub2/grub.cfg |grep menuentry

可以發現有最新版本的核心,此時可以設定最新版本核心為預設啟動:

grub2-set-default 'CentOS Linux (4.8.5-1.el7.elrepo.x86_64) 7 (Core)'

此時,查看預設啟動的系統版本grub2-editenv list:

顯示為'CentOS Linux (4.8.5-1.el7.elrepo.x86_64) 7 (Core)'

8 reboot,重啟之後再次查看 uname -r

註:筆者只試過第一種,第二種看官有興趣可以試試,理論上可以success。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.