centos 7升级内核

简单的升级内核

# rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
# 查看kernrl版本
# yum –disablerepo=”*” –enablerepo=”elrepo-kernel” list available
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo-kernel: syd.mirror.rackspace.com
Available Packages
elrepo-release.noarch                                                    7.0-5.el7.elrepo                                            elrepo-kernel
kernel-lt.x86_64                                                         4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-lt-devel.x86_64                                                   4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-lt-doc.noarch                                                     4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-lt-headers.x86_64                                                 4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-lt-tools.x86_64                                                   4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-lt-tools-libs.x86_64                                              4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                        4.4.241-1.el7.elrepo                                        elrepo-kernel
kernel-ml-doc.noarch                                                     5.9.6-1.el7.elrepo                                          elrepo-kernel
kernel-ml-headers.x86_64                                                 5.9.6-1.el7.elrepo                                          elrepo-kernel
kernel-ml-tools.x86_64                                                   5.9.6-1.el7.elrepo                                          elrepo-kernel
kernel-ml-tools-libs.x86_64                                              5.9.6-1.el7.elrepo                                          elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                                        5.9.6-1.el7.elrepo                                          elrepo-kernel
perf.x86_64                                                              5.9.6-1.el7.elrepo                                          elrepo-kernel
python-perf.x86_64                                                       5.9.6-1.el7.elrepo                                          elrepo-kernel

版本性质:主分支ml(mainline),稳定版(stable),长期维护版lt(longterm)

# yum -y –enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64

# 查看安装好的kernel,已经安装成功
[root@qd01-stop-k8s-node004 ~]# rpm -qa|grep kernel
kernel-headers-3.10.0-957.el7.x86_64
kernel-tools-libs-3.10.0-957.el7.x86_64
kernel-ml-devel-5.9.6-1.el7.elrepo.x86_64
kernel-3.10.0-957.el7.x86_64
abrt-addon-kerneloops-2.1.11-52.el7.centos.x86_64
kernel-devel-3.10.0-957.el7.x86_64
kernel-tools-3.10.0-957.el7.x86_64
kernel-ml-5.9.6-1.el7.elrepo.x86_64
libreport-plugin-kerneloops-2.1.11-42.el7.centos.x86_64

cat  /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=”console”
GRUB_CMDLINE_LINUX=”ipv6.disable=1 crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet”
GRUB_DISABLE_RECOVERY=”true”

grub2-mkconfig -o /boot/grub2/grub.cfg

查看内核启动

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

设置默认启动

grub2-set-default "CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)" 
验证是否修改成功:

grub2-editenv list 
saved_entry=CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core.


reboot









发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注