Centos7.2 system upgrade kernel

Tip: After the article is written, the table of contents can be automatically generated. How to generate it can refer to the help document on the right


foreword

I prefer a gentleman who is good at speech and quick in action to a gentleman who is slow in speech but quick in action.


Since the 3.x kernel version of the Centos7 system is unstable in large-scale clusters, the kernel needs to be upgraded. (All machines must be upgraded to the same)

### View system version

cat /etc/redhat-release

### View the current kernel version

uname -r

 

### Check if ELRepo is installed

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

### Upgrade and install ELRepo 

#安装
yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
#或升级
rpm -Uvh https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

### View available packages

yum  --disablerepo="*"  --enablerepo="elrepo-kernel"  list  available
# 长期维护版本为lt,最新主线稳定版为ml

### Install the latest kernel 

The long-term maintenance version is lt and the stable version is ml

yum  --enablerepo=elrepo-kernel  install  -y  kernel-lt

### View available kernel versions and boot sequence 

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg

 

### Install the auxiliary tool grub2-pc (some will come with it, if not, just install it)

yum install -y grub2-pc

### Set the kernel default boot order

grub2-set-default 0

### vim /etc/default/grub

GRUB_DEFAULT=0 #Here changed from the original saved to 0

### Generate grub configuration file

# Run the grub2-mkconfig command to recreate the kernel configuration

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

 

### Restart the system

reboot
#或
shutdown -r now

 

### Check if the kernel version is correct

uname -r

###Install the yum-utils tool

#当系统安装的内核大于3个时,会自动删除旧的内核版本
yum install -y  yum-utils
#或自己查看已经安装的内核后手动yum  remove -y 进行删除旧版本
rpm -qa | grep kernel
yum remove -y  kernel-devel-3.10.0   kernel-3.10.0  kernel-headers-3.10.0 

 

### Remove old toolkits

yum remove kernel-tools-libs.x86_64 kernel-tools.x86_64

### Install the new version of the toolkit

yum --disablerepo=\* --enablerepo=elrepo-kernel install -y kernel-lt-tools.x86_64

### View installed kernels

rpm -qa | grep kernel

Guess you like

Origin blog.csdn.net/m0_59029800/article/details/130293737