Centos7 升级内核为最新长期维护版 4.4
作者:互联网
elrepo 官网
http://elrepo.org
https://elrepo.org/tiki/tiki-index.php
安装 ELRepo源
# 查看内核
[root@localhost ~]# uname -r
# 安装 Yum密钥
[root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# 安装对应的Yum源
# To install ELRepo for RHEL-**8** or CentOS-**8**:
- yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
# To install ELRepo for RHEL-**7**, SL-**7** or CentOS-**7**:
需要安装 yum -y install yum-plugin-fastestmirror
- yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
# To install ELRepo for RHEL-**6**, SL-**6** or CentOS-**6**:
需要安装 yum -y install yum-plugin-fastestmirror
- yum install https://www.elrepo.org/elrepo-release-6.el6.elrepo.noarch.rpm
Centos7 安装内核
# 导入源
[root@localhost ~]# yum -y install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available 查看kernel的版本
# lt:longterm的缩写:长期维护版
# ml:mainline的缩写:最新稳定版
# 安装最新长期维护版kernel
[root@localhost ~]# yum -y --enablerepo=elrepo-kernel install kernel-lt
# 设置为默认为最新版本kernel
[root@localhost ~]# grub2-set-default 0
[root@localhost ~]# reboot
# 查看修改后结果
[root@localhost ~]# uname -r
[root@localhost ~]# uname -r
3.10.0-1127.13.1.el7.x86_64
# 1. 查看当前default的entry
[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core)
# 2. 查看所有的entry
[root@localhost ~]# awk -F \' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core)
1 : CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-fc3fb3f757784457a95f1652cd0c7f93) 7 (Core)
[root@localhost ~]# grub2-set-default "CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core)"
# [root@localhost ~]# grub2-set-default 1 (第二种方式,输入对应的内核编号)
# 3. 结果查看
[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core)
[root@localhost ~]# uname -r
3.10.0-1127.13.1.el7.x86_64
# [root@server2 ~]# reboot (重启使设置生效)
其他的选择(补充)
# boot 空间占用清除
[root@localhost ~]# df -h /boot/
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 190M 88M 88M 68% /boot
[root@localhost ~]# uname -r
4.4.236-1.el7.elrepo.x86_64
[root@localhost boot]# rpm -q kernel
kernel-3.10.0....el7.x86_64
kernel-3.10.0....el7.x86_64
[root@localhost boot]# rpm -e kernel-3.10.0....el7.x86_64
[root@localhost ~]# df -h /boot/
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 190M 116M 60M 66% /boot
[root@localhost ~]# rpm -q kernel-lt
kernel-lt-4.4.236-1.el7.elrepo.x86_64
升级内核,解决:在最新的软件需要内核依赖
标签:4.4,x86,elrepo,Centos7,64,内核,root,el7,localhost 来源: https://www.cnblogs.com/yunweizhijun/p/15391181.html