亲宝软件园·资讯

展开

Centos 8.2 升级内核

娇小赤雅 人气:2

一、Centos 8.2 升级内核通过elrepo源

地址

查看linux内核版本

[root@localhost ~]# cat /proc/version 
Linux version 4.18.0-193.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Fri May 8 10:59:10 UTC 2020
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-193.el8.x86_64 #1 SMP Fri May 8 10:59:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

查看yum中可升级的内核版本

[root@localhost ~]#  yum list kernel --showduplicates
CentOS Linux 8 - BaseOS                                                           1.2 MB/s | 4.6 MB     00:03    
CentOS-8 - Extras                                                                 4.9 kB/s |  11 kB     00:02    
Last metadata expiration check: 0:00:01 ago on Sat 15 Oct 2022 02:58:01 PM CST.
Installed Packages
kernel.x86_64                                    4.18.0-193.el8                                          @anaconda
Available Packages
kernel.x86_64                                    4.18.0-348.el8                                          baseos   
kernel.x86_64                                    4.18.0-348.2.1.el8_5                                    baseos   
kernel.x86_64                                    4.18.0-348.7.1.el8_5                                    baseos

注意:可能要配置yum原(去找找吧)当然在我 二进制安装kubernetes 最后标题报错有配置yum原

导入ELRepo软件仓库的公共秘钥

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

CentOS 8 系统安装ELRepo

[root@localhost ~]#  rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@localhost ~]#  yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
Last metadata expiration check: 0:05:56 ago on Sat 15 Oct 2022 02:58:01 PM CST.
elrepo-release-8.el8.elrepo.noarch.rpm                                            6.7 kB/s |  13 kB     00:01    
Dependencies resolved.
==================================================================================================================
 Package                     Architecture        Version                          Repository                 Size
==================================================================================================================
Installing:
 elrepo-release              noarch              8.3-1.el8.elrepo                 @commandline               13 k

Transaction Summary
==================================================================================================================
Install  1 Package

Total size: 13 k
Installed size: 5.0 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                          1/1 
  Installing       : elrepo-release-8.3-1.el8.elrepo.noarch                                                   1/1 
  Verifying        : elrepo-release-8.3-1.el8.elrepo.noarch                                                   1/1 
Installed products updated.

Installed:
  elrepo-release-8.3-1.el8.elrepo.noarch                                                                          

Complete!

查看ELRepo提供的内核版本

内核版本简写说明

kernel-lt(lt=long-term)长期有效

kernel-ml(ml=mainline)主流版本

[root@localhost ~]#  yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
ELRepo.org Community Enterprise Linux Kernel Repository - el8                      31 kB/s | 2.1 MB     01:08    
Last metadata expiration check: 0:00:01 ago on Sat 15 Oct 2022 03:06:34 PM CST.
Available Packages
bpftool.x86_64                                           6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-lt.x86_64                                         5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-core.x86_64                                    5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-devel.x86_64                                   5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-doc.noarch                                     5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-headers.x86_64                                 5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-modules.x86_64                                 5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-modules-extra.x86_64                           5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-tools.x86_64                                   5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-tools-libs.x86_64                              5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                        5.4.217-1.el8.elrepo                        elrepo-kernel
kernel-ml.x86_64                                         6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-core.x86_64                                    6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-devel.x86_64                                   6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-doc.noarch                                     6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-headers.x86_64                                 6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-modules.x86_64                                 6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-modules-extra.x86_64                           6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-tools.x86_64                                   6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-tools-libs.x86_64                              6.0.1-1.el8.elrepo                          elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                        6.0.1-1.el8.elrepo                          elrepo-kernel
perf.x86_64                                              6.0.1-1.el8.elrepo                          elrepo-kernel
python3-perf.x86_64                                      6.0.1-1.el8.elrepo                          elrepo-kerne

安装长期支持的内核

[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-lt.x86_64 kernel-lt-devel.x86_64
ELRepo.org Community Enterprise Linux Repository - el8                            5.4 kB/s | 259 kB     00:47    
ELRepo.org Community Enterprise Linux Kernel Repository - el8                     353 kB/s | 2.1 MB     00:06    
Last metadata expiration check: 0:00:01 ago on Sat 15 Oct 2022 03:14:19 PM CST.
Dependencies resolved.
==================================================================================================================
 Package                      Architecture      Version                            Repository                Size
==================================================================================================================
Installing:
 kernel-lt                    x86_64            5.4.217-1.el8.elrepo               elrepo-kernel             75 k
 kernel-lt-devel              x86_64            5.4.217-1.el8.elrepo               elrepo-kernel             13 M
Installing dependencies:
 kernel-lt-core               x86_64            5.4.217-1.el8.elrepo               elrepo-kernel             28 M
 kernel-lt-modules            x86_64            5.4.217-1.el8.elrepo               elrepo-kernel             25 M

Transaction Summary
==================================================================================================================
Install  4 Packages

Total download size: 66 M
Installed size: 136 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): kernel-lt-5.4.217-1.el8.elrepo.x86_64.rpm                                   69 kB/s |  75 kB     00:01    
(2/4): kernel-lt-devel-5.4.217-1.el8.elrepo.x86_64.rpm                            1.2 MB/s |  13 MB     00:10    
(3/4): kernel-lt-core-5.4.217-1.el8.elrepo.x86_64.rpm                             719 kB/s |  28 MB     00:40    
(4/4): kernel-lt-modules-5.4.217-1.el8.elrepo.x86_64.rpm                          339 kB/s |  25 MB     01:14    
------------------------------------------------------------------------------------------------------------------
Total                                                                             371 kB/s |  66 MB     03:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                          1/1 
  Installing       : kernel-lt-core-5.4.217-1.el8.elrepo.x86_64                                               1/4 
  Running scriptlet: kernel-lt-core-5.4.217-1.el8.elrepo.x86_64                                               1/4 
  Installing       : kernel-lt-modules-5.4.217-1.el8.elrepo.x86_64                                            2/4 
  Running scriptlet: kernel-lt-modules-5.4.217-1.el8.elrepo.x86_64                                            2/4 
  Installing       : kernel-lt-5.4.217-1.el8.elrepo.x86_64                                                    3/4 
  Installing       : kernel-lt-devel-5.4.217-1.el8.elrepo.x86_64                                              4/4 
  Running scriptlet: kernel-lt-devel-5.4.217-1.el8.elrepo.x86_64                                              4/4 
  Running scriptlet: kernel-lt-core-5.4.217-1.el8.elrepo.x86_64                                               4/4 
  Running scriptlet: kernel-lt-devel-5.4.217-1.el8.elrepo.x86_64                                              4/4 
  Verifying        : kernel-lt-5.4.217-1.el8.elrepo.x86_64                                                    1/4 
  Verifying        : kernel-lt-core-5.4.217-1.el8.elrepo.x86_64                                               2/4 
  Verifying        : kernel-lt-devel-5.4.217-1.el8.elrepo.x86_64                                              3/4 
  Verifying        : kernel-lt-modules-5.4.217-1.el8.elrepo.x86_64                                            4/4 
Installed products updated.

Installed:
  kernel-lt-5.4.217-1.el8.elrepo.x86_64                  kernel-lt-core-5.4.217-1.el8.elrepo.x86_64              
  kernel-lt-devel-5.4.217-1.el8.elrepo.x86_64            kernel-lt-modules-5.4.217-1.el8.elrepo.x86_64           

Complete!

查看系统可用内核,并设置启动项

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

有知道的可以评论留言下,非常感谢![8 不好使]

指定开机启动内核版本

grub2-set-default 0

生成 grub 配置文件

[root@localhost ~]# grub2-set-default 0
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

重启

reboot

验证

cat /proc/version
uname -r

加载全部内容

相关教程
猜你喜欢
用户评论