centos7.5更新內核到4.18穩定版


centos7.5更新內核到4.18

Docker對Linux內核版本的最低要求是3.10。目前Linux內核已經發布到 4.18,為了更好使用docker和k8s,需要對公司相關CentOS 7內核進行升級。

docker官方對內核的說明:
https://docs.docker.com/storage/storagedriver/overlayfs-driver/
Docker存儲驅動說明,overlay可以使用但不建議,最好使用overlay2,內核需要4.0以上,或者CentOS7的內核在3.10.0-514以上,需要額外的設置參數,禁止檢測內核為4.0版本。
If you use OverlayFS, use the overlay2 driver rather than the overlay driver, because it is more efficient in terms of inode utilization. To use the new driver, you need version 4.0 or higher of the Linux kernel, unless you are a Docker EE user on RHEL or CentOS, in which case you need version 3.10.0-514 or higher of the kernel and to follow some extra steps.

對Docker EE 17.06.02-ee5 and 17.06.02-ee6,CentOS7的內核在3.10.0-514以上,需要額外的設置參數,禁止檢測內核為4.0版本。
Note: RHEL and CentOS users on Docker EE 17.06.02-ee5 and 17.06.02-ee6
You need to add a second option to the daemon.json to disable the check for version 4.0 or higher of the Linux kernel. Your daemon.json should look like the following. This is only needed for Docker EE users of RHEL or CentOS. Do not attempt to use overlay2 with kernel versions older than 3.10.0-514.

下載公鑰

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

安裝elrepo repo

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

倉庫啟用后,列出可用的內核相關包:

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available 

查詢所有kernel包

rpm -qa|grep kernel
kernel-devel-3.10.0-862.6.3.el7.x86_64
kernel-tools-libs-3.10.0-862.6.3.el7.x86_64
kernel-tools-3.10.0-862.6.3.el7.x86_64
kernel-devel-3.10.0-862.el7.x86_64
abrt-addon-kerneloops-2.1.11-50.el7.centos.x86_64
kernel-3.10.0-862.6.3.el7.x86_64
kernel-headers-3.10.0-862.6.3.el7.x86_64

根據上述查詢結果,刪除所有舊內核相關包

yum remove kernel-devel kernel-tools-libs kernel-tools kernel-headers

卸載上述軟件包會連帶卸載以下安裝包需要更新后,重新安裝。kernel-devel會連帶刪除systemtap和systemtap-devel。kernel-headers則和下面都有關系。

compat-glibc   x86_64   1:2.12-4.el7.centos
compat-glibc-headers  x86_64   1:2.12-4.el7.centos
gcc x86_64   4.8.5-28.el7_5.1
gcc-c++x86_64   4.8.5-28.el7_5.1
gcc-gfortran   x86_64   4.8.5-28.el7_5.1
glibc-develx86_64   2.17-222.el7
glibc-headers  x86_64   2.17-222.el7
libquadmath-devel  x86_64   4.8.5-28.el7_5.1
libtool x86_64   2.4.2-22.el7_3
systemtap   x86_64   3.2-8.el7_5
systemtap-develx86_64   3.2-8.el7_5

安裝新內核

yum --enablerepo=elrepo-kernel install -y kernel-ml.x86_64

安裝新內核相關軟件

yum --disablerepo=\* --enablerepo=elrepo-kernel install -y  kernel-ml-devel kernel-ml-tools kernel-ml-tools-libs kernel-ml-tools-libs-devel kernel-ml-headers

查看默認內核

grub2-editenv list

將新內核設為默認grbu啟動項

grub2-set-default 0

生成 grub 配置文件

grub2-mkconfig -o /etc/grub2.cfg
reboot   #不重啟也可以

刪除舊內核

yum remove kernel-3.10.0-862.6.3.el7.x86_64

安裝更新舊內核時被卸載的軟件

yum install -y compat-glibc compat-glibc-headers gcc gcc-c++ gcc-gfortran glibc-devel glibc-headers libquadmath-devel libtool systemtap systemtap-devel

查看默認內核

grub2-editenv list
saved_entry=CentOS Linux (4.18.11-1.el7.elrepo.x86_64) 7 (Core)


免責聲明!

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



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