linux通过源码包升级特定内核版本

附带一个内核二进制包下载地址:

https://www.kernel.org/

4.4内核:

链接:https://pan.baidu.com/s/1FOVcJj3mSAsr9SUNI6DjRg
提取码:lz1p

1.首先查看当前使用的内核版本以及本机所有可使用的内核版本

[root@localhost ~]# uname -r && awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
3.10.0-1160.11.1.el7.x86_64                ##此为当前使用的内核版本
0 : CentOS Linux (3.10.0-1160.11.1.el7.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-3675a34d3aee461a8fb66bad052c528a) 7 (Core)

2.将准备好的内核进行升级

[root@localhost ~]# ll && yum localinstall -y kernel-lt-4.4.249-1.el7.elrepo.x86_64.rpm kernel-lt-devel-4.4.249-1.el7.elrepo.x86_64.rpm 
total 51360
-rw-------. 1 root root     1259 Jan 26 17:39 anaconda-ks.cfg
-rw-r--r--. 1 root root 41847268 Jan 27 17:47 kernel-lt-4.4.249-1.el7.elrepo.x86_64.rpm
-rw-r--r--. 1 root root 10735844 Jan 27 17:47 kernel-lt-devel-4.4.249-1.el7.elrepo.x86_64.rpm
Loaded plugins: fastestmirror
Examining kernel-lt-4.4.249-1.el7.elrepo.x86_64.rpm: kernel-lt-4.4.249-1.el7.elrepo.x86_64
Marking kernel-lt-4.4.249-1.el7.elrepo.x86_64.rpm to be installed
Examining kernel-lt-devel-4.4.249-1.el7.elrepo.x86_64.rpm: kernel-lt-devel-4.4.249-1.el7.elrepo.x86_64
Marking kernel-lt-devel-4.4.249-1.el7.elrepo.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kernel-lt.x86_64 0:4.4.249-1.el7.elrepo will be installed
---> Package kernel-lt-devel.x86_64 0:4.4.249-1.el7.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================
 Package                           Arch                     Version                                  Repository                                                      Size
==========================================================================================================================================================================
Installing:
 kernel-lt                         x86_64                   4.4.249-1.el7.elrepo                     /kernel-lt-4.4.249-1.el7.elrepo.x86_64                         182 M
 kernel-lt-devel                   x86_64                   4.4.249-1.el7.elrepo                     /kernel-lt-devel-4.4.249-1.el7.elrepo.x86_64  

3.再次查看当前系统所有可使用的内核,可以看到刚刚准备的内核已安装成功

[root@localhost ~]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (4.4.249-1.el7.elrepo.x86_64) 7 (Core)   
1 : CentOS Linux (3.10.0-1160.11.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-3675a34d3aee461a8fb66bad052c528a) 7 (Core)

4.设置开机从新内核启动,随后重启

[root@localhost ~]# grub2-set-default "CentOS Linux (4.4.249-1.el7.elrepo.x86_64) 7 (Core)"
[root@localhost ~]# reboot

5.重启后查看系统当前使用的内核

[root@localhost ~]# uname -r
4.4.249-1.el7.elrepo.x86_64

 升级成功!!!

 

posted @ 2021-01-27 10:07  Sqlserverwooooo  阅读(384)  评论(0编辑  收藏  举报