标签:reboot sys list pack import main time 变化 内核版本
关于内核说明:
版本性质:主分支ml(mainline),稳定版(stable),长期维护lt(longterm)
版本命名格式:“A.B.C"
A代表内核版本号
B代表内核主版本号
C代表内核次版本号
[root@web1 ~]# uname -r
3.10.0-514.el7.x86_64
[root@web1 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@web1 ~]#
这里只关注centos7如何升级
1、导入elrepo的key然后在安装elrepo的yum源:
rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org ###key
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm ###yum源
2、查看可用的内核相关的包
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
1 [root@web1 ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
2 Loaded plugins: fastestmirror, langpacks
3 elrepo-kernel | 2.9 kB 00:00:00
4 elrepo-kernel/primary_db | 1.8 MB 00:00:02
5 Loading mirror speeds from cached hostfile
6 * elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
7 Available Packages
8 kernel-lt.x86_64 4.4.180-2.el7.elrepo elrepo-kernel
9 kernel-lt-devel.x86_64 4.4.180-2.el7.elrepo elrepo-kernel
10 kernel-lt-doc.noarch 4.4.180-2.el7.elrepo elrepo-kernel
11 kernel-lt-headers.x86_64 4.4.180-2.el7.elrepo elrepo-kernel
12 kernel-lt-tools.x86_64 4.4.180-2.el7.elrepo elrepo-kernel
13 kernel-lt-tools-libs.x86_64 4.4.180-2.el7.elrepo elrepo-kernel
14 kernel-lt-tools-libs-devel.x86_64 4.4.180-2.el7.elrepo elrepo-kernel
15 kernel-ml.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
16 kernel-ml-devel.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
17 kernel-ml-doc.noarch 5.1.5-1.el7.elrepo elrepo-kernel
18 kernel-ml-headers.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
19 kernel-ml-tools.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
20 kernel-ml-tools-libs.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
21 kernel-ml-tools-libs-devel.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
22 perf.x86_64 5.1.5-1.el7.elrepo elrepo-kernel
23 python-perf.x86_64 5.1.5-1.el7.elrepo
3、安装内核(我这里用最新的吧)以后如何继续升级直接用下面这条命令就可以了
yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64
使用新内核启动
# 使用新内核启动: grub2-set-default 0 reboot
---------------------------------------------------------------------------------------------下面的可不用看
内核升级完成后,还需要调整
1、查看内核启动顺序
awk -F\‘ ‘$1=="menuentry " {print $2}‘ /etc/grub2.cfg
通过此命令可以看到新内核顺序为0
1 [root@web1 ~]# awk -F\‘ ‘$1=="menuentry " {print $2}‘ /etc/grub2.cfg
2 CentOS Linux (5.1.5-1.el7.elrepo.x86_64) 7 (Core)
3 CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
4 CentOS Linux (0-rescue-b7671beb75f14e95b5a58975dae3a897) 7 (Core)
5 You have new mail in /var/spool/mail/root
6 [root@web1 ~]# vim /etc/default/g
7 google-chrome grub
2、修改内核启动顺序为0
vim /etc/default/grub
1 [root@web1 ~]# vim /etc/default/grub
2
3 GRUB_TIMEOUT=5
4 GRUB_DISTRIBUTOR="$(sed ‘s, release .*$,,g‘ /etc/system-release)"
5 GRUB_DEFAULT=0
6 GRUB_DISABLE_SUBMENU=true
7 GRUB_TERMINAL_OUTPUT="console"
8 GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0 "
9 GRUB_DISABLE_RECOVERY="true"
3、接着用命令来创建内核配置
grub2-mkconfig -o /boot/grub2/grub.cfg
1 [root@web1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
2 Generating grub configuration file ...
3 Found linux image: /boot/vmlinuz-5.1.5-1.el7.elrepo.x86_64
4 Found initrd image: /boot/initramfs-5.1.5-1.el7.elrepo.x86_64.img
5 Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
6 Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
7 Found linux image: /boot/vmlinuz-0-rescue-b7671beb75f14e95b5a58975dae3a897
8 Found initrd image: /boot/initramfs-0-rescue-b7671beb75f14e95b5a58975dae3a897.img
9 done
4、重启查看变化
init 6或者reboot
[root@web1 ~]# init 6
[root@web1 ~]# uname -r
5.1.5-1.el7.elrepo.x86_64
[root@web1 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@web1 ~]#
参考:升级Centos 7/6内核版本到4.12.4的方法,还介绍了无法上网机器的升级方法
标签:reboot sys list pack import main time 变化 内核版本
原文地址:https://www.cnblogs.com/chengkanghua/p/12516551.html