Centos7升级内核

 

 

kernel包下载
https://elrepo.org/linux/kernel/el7/x86_64/RPMS/
参考博客
https://blog.csdn.net/u010766726/article/details/108484746

 

  1 [root@yt-compute-r56-25 ~]# rpm -qa |grep kernel
  2 kernel-devel-3.10.0-1160.el7.x86_64
  3 kernel-tools-3.10.0-1160.el7.x86_64
  4 kernel-tools-libs-3.10.0-1160.el7.x86_64
  5 kernel-headers-4.18.0-193.el8.x86_64
  6 kernel-3.10.0-1160.el7.x86_64
  7 [root@yt-compute-r56-25 ~]# for i in `rpm -qa|grep kernel`;do rpm -e "${i}" --nodeps;done
  8 warning: file /lib/modules/3.10.0-1160.el7.x86_64/updates: remove failed: No such file or directory
  9 [root@yt-compute-r56-25 ~]# rpm -qa |grep kernel
 10 [root@yt-compute-r56-25 ~]# rpm -qa |grep kernel
 11 [root@yt-compute-r56-25 ~]# 
 12 [root@yt-compute-r56-25 ~]# ll
 13 total 5469272
 14 -rw-------.  1 root root       1837 Jun 30 17:15 anaconda-ks.cfg
 15 -rw-r--r--   1 root root       8912 Jul 10 19:13 elrepo-release-7.el7.elrepo.noarch.rpm
 16 -rw-------   1 root root 5382917120 Jul  2 10:24 gpu_centos7_cuda11_v11.tar
 17 -rw-r--r--   1 root root   18787608 Jul  2 10:04 kernel-devel-3.10.0-1160.el7.x86_64.rpm
 18 -rw-r--r--   1 root root   61101152 Jul 23 20:11 kernel-ml-5.18.14-1.el7.elrepo.x86_64.rpm
 19 -rw-r--r--   1 root root   14789108 Jul 23 20:11 kernel-ml-devel-5.18.14-1.el7.elrepo.x86_64.rpm
 20 -rw-r--r--   1 root root    1644584 Jul 23 20:11 kernel-ml-headers-5.18.14-1.el7.elrepo.x86_64.rpm
 21 -rw-r--r--   1 root root     275160 Jul 23 20:11 kernel-ml-tools-5.18.14-1.el7.elrepo.x86_64.rpm
 22 -rw-r--r--   1 root root     156980 Jul 23 20:11 kernel-ml-tools-libs-5.18.14-1.el7.elrepo.x86_64.rpm
 23 -rw-r--r--   1 root root     132980 Jul 23 20:11 kernel-ml-tools-libs-devel-5.18.14-1.el7.elrepo.x86_64.rpm
 24 -rw-r--r--   1 root root  120688920 Sep 22  2021 linux-5.14.7.tar.xz
 25 drwxr-xr-x  11 root root        201 Jul  2 10:09 NVIDIA_CUDA-11.4_Samples
 26 -rw-r--r--   1 root root       1722 Mar 28  2009 RPM-GPG-KEY-elrepo.org
 27 [root@yt-compute-r56-25 ~]# rpm -vih kernel-ml-5.18.14-1.el7.elrepo.x86_64.rpm 
 28 Preparing...                          ################################# [100%]
 29 Updating / installing...
 30    1:kernel-ml-5.18.14-1.el7.elrepo   ################################# [100%]
 31 dkms: running auto installation service for kernel 5.18.14-1.el7.elrepo.x86_64
 32  Done. 
 33 [root@yt-compute-r56-25 ~]# rpm -ivh kernel-ml-devel-5.18.14-1.el7.elrepo.x86_64.rpm 
 34 Preparing...                          ################################# [100%]
 35 Updating / installing...
 36    1:kernel-ml-devel-5.18.14-1.el7.elr################################# [100%]
 37 [root@yt-compute-r56-25 ~]# rpm -ivh kernel-ml-headers-5.18.14-1.el7.elrepo.x86_64.rpm 
 38 Preparing...                          ################################# [100%]
 39 Updating / installing...
 40    1:kernel-ml-headers-5.18.14-1.el7.e################################# [100%]
 41 [root@yt-compute-r56-25 ~]# rpm -ivh kernel-ml-tools-
 42 kernel-ml-tools-5.18.14-1.el7.elrepo.x86_64.rpm             kernel-ml-tools-libs-5.18.14-1.el7.elrepo.x86_64.rpm        kernel-ml-tools-libs-devel-5.18.14-1.el7.elrepo.x86_64.rpm  
 43 
 44 [root@yt-compute-r56-25 ~]# rpm -qa |grep kernel
 45 kernel-ml-headers-5.18.14-1.el7.elrepo.x86_64
 46 kernel-ml-devel-5.18.14-1.el7.elrepo.x86_64
 47 kernel-ml-5.18.14-1.el7.elrepo.x86_64
 48 [root@yt-compute-r56-25 ~]# rpm -ivh kernel-ml-tools-*
 49 Preparing...                          ################################# [100%]
 50 Updating / installing...
 51    1:kernel-ml-tools-libs-5.18.14-1.el################################# [ 33%]
 52    2:kernel-ml-tools-5.18.14-1.el7.elr################################# [ 67%]
 53    3:kernel-ml-tools-libs-devel-5.18.1################################# [100%]
 54 [root@yt-compute-r56-25 ~]# rpm -qa |grep kernel
 55 kernel-ml-headers-5.18.14-1.el7.elrepo.x86_64
 56 kernel-ml-devel-5.18.14-1.el7.elrepo.x86_64
 57 kernel-ml-tools-libs-5.18.14-1.el7.elrepo.x86_64
 58 kernel-ml-tools-libs-devel-5.18.14-1.el7.elrepo.x86_64
 59 kernel-ml-5.18.14-1.el7.elrepo.x86_64
 60 kernel-ml-tools-5.18.14-1.el7.elrepo.x86_64
 61 [root@yt-compute-r56-25 ~]# vim /etc/default/
 62 grub     nss      useradd  
 63 [root@yt-compute-r56-25 ~]# vim /etc/default/grub 
 64 [root@yt-compute-r56-25 ~]# vim /etc/default/grub 
 65 [root@yt-compute-r56-25 ~]# 
 66 [root@yt-compute-r56-25 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
 67 Generating grub configuration file ...
 68 Found linux image: /boot/vmlinuz-5.18.14-1.el7.elrepo.x86_64
 69 Found initrd image: /boot/initramfs-5.18.14-1.el7.elrepo.x86_64.img
 70 Found linux image: /boot/vmlinuz-4.1.35
 71 Found initrd image: /boot/initramfs-4.1.35.img
 72 Found linux image: /boot/vmlinuz-4.1.35.old
 73 Found initrd image: /boot/initramfs-4.1.35.img
 74 Found linux image: /boot/vmlinuz-0-rescue-3214a594cd464aa4b9cb04679cf10aac
 75 Found initrd image: /boot/initramfs-0-rescue-3214a594cd464aa4b9cb04679cf10aac.img
 76 done
 77 [root@yt-compute-r56-25 ~]# 
 78 [root@yt-compute-r56-25 ~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
 79 CentOS Linux (5.18.14-1.el7.elrepo.x86_64) 7 (Core)
 80 CentOS Linux (4.1.35) 7 (Core)
 81 CentOS Linux (4.1.35.old) 7 (Core)
 82 CentOS Linux (0-rescue-3214a594cd464aa4b9cb04679cf10aac) 7 (Core)
 83 [root@yt-compute-r56-25 ~]# reboot
 84 
 85 
 86 [root@yt-compute-r56-25 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
 87 Generating grub configuration file ...
 88 Found linux image: /boot/vmlinuz-5.18.14-1.el7.elrepo.x86_64
 89 Found initrd image: /boot/initramfs-5.18.14-1.el7.elrepo.x86_64.img
 90 Found linux image: /boot/vmlinuz-0-rescue-3214a594cd464aa4b9cb04679cf10aac
 91 Found initrd image: /boot/initramfs-0-rescue-3214a594cd464aa4b9cb04679cf10aac.img
 92 done
 93 
 94 
 95 [root@yt-compute-r56-25 ~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
 96 CentOS Linux (5.18.14-1.el7.elrepo.x86_64) 7 (Core)
 97 CentOS Linux (0-rescue-3214a594cd464aa4b9cb04679cf10aac) 7 (Core)
 98 [root@yt-compute-r56-25 ~]# 
 99 
100 [root@yt-compute-r56-25 ~]# grub2-set-default 0
101 [root@yt-compute-r56-25 ~]# grub2-editenv list
102 saved_entry=0
103 [root@yt-compute-r56-25 ~]# 
104 
105 [root@yt-compute-r56-25 ~]# vim /etc/default/
106 grub     nss      useradd  
107 [root@yt-compute-r56-25 ~]# vim /etc/default/grub 
108 
109 [root@yt-compute-r56-25 ~]# reboot
110 
111 
112 
113 内核删除
114 如果有时候想要删除自己编译的内核 就需要手动删除一些文件 注意不要用dpkg那些 因为这个内核是你自己装的 不归它管
115 主要就是进入/boot 删除对应版本的所有信息
116 还有一个就是/lib/modules里对应版本的文件夹
117 
118 全部删除完成之后 update-grub2就ok了
119 
120 原文链接:https://blog.csdn.net/qq_40819252/article/details/120909453
View Code

 

posted on 2022-07-28 16:00  微子天明  阅读(30)  评论(0编辑  收藏  举报

导航