centos install a newer version of kernel methods

Sometimes because the system kernel bug we have to install the new version of the kernel to solve the problem, there are several ways

  • Source compiler
  • Use compiled package

More convenient way to use the package, while some of the dependency problems automatically help us deal

Add yum source

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

Enable repo

You can modify the file
/etc/yum.repos.d/elrepo.repo reference to the following

 
[elrepo-kernel]
name=ELRepo.org Community Enterprise Linux Kernel Repository - el7
baseurl = http: //elrepo.org/linux/kernel/el7/$basearch/
 http://mirrors.coreix.net/elrepo/kernel/el7/$basearch/
 http://mirror.rackspace.com/elrepo/kernel/el7/$basearch/
 http://repos.lax-noc.com/elrepo/kernel/el7/$basearch/
 http://mirror.ventraip.net.au/elrepo/kernel/el7/$basearch/
mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo-kernel.el7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
 

or

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

Refresh cache

yum clean dbcache
yum makecache

installation

yum install -y kernel-lt or yum install -y kernel-ml

Modify grub boot

  • Modify the file
    / etc / default / grub and set GRUB_DEFAULT = 0, so that the first page of the kernel initialization GRUB as the default kernel.
 
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto noibrs idle=halt net.ifnames=0 console=tty0 console=ttyS0,115200n8"
GRUB_DISABLE_RECOVERY="true"
  • Re-create the kernel configuration
grub2 - mkconfig - the / boot / grub2 / grub. cfg
 

effect

grub2 - mkconfig - the / boot / grub2 / grub. cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.1.5-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.1.5-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-4.4.180-2.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.4.180-2.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.5.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.5.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-20181212155109274552296824485474
Found initrd image: /boot/initramfs-0-rescue-20181212155109274552296824485474.img
done
  • Reboot the system
reboot
  • View results
uname -a
Linux iZ2zeg7uro1snhd9wqmp2oZ 5.1.5-1.el7.elrepo.x86_64 #1 SMP Sat May 25 16:10:51 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

Reference material

https://elrepo.org/tiki/kernel-lt

Guess you like

Origin www.cnblogs.com/rongfengliang/p/10930097.html