CentOS 7

CentOS7下的各种应用


内核升级

<p>内核升级后,设置内核启动顺序步骤:</p> <h3>1、查看设备上安装了几个内核</h3> <p>cat /boot/grub2/grub.cfg |grep menuentry</p> <h3>2、查看当前内核</h3> <p>grub2-editenv list</p> <h3>3、修改默认启动的内核</h3> <p>grub2-set-default 'CentOS Linux (4.15.15-1.el7.elrepo.x86_64) 7 (Core)'</p> <h1>worker节点升级CentOS7系统,并设置内核为5.5.1</h1> <pre><code class="language-bash">#!/bin/bash yum -y update startuname=`cat /boot/grub2/grub.cfg |grep menuentry |grep 5.5 |awk -F &amp;quot;'&amp;quot; '{print $2}'` grub2-set-default '$startuname' reboot</code></pre> <h1>另一种方法</h1> <pre><code>[root@worker03 ~]#cat /boot/grub2/grub.cfg |grep menuentry if [ x&amp;quot;${feature_menuentry_id}&amp;quot; = xy ]; then menuentry_id_option=&amp;quot;--id&amp;quot; menuentry_id_option=&amp;quot;&amp;quot; export menuentry_id_option menuentry 'CentOS Linux (3.10.0-1160.76.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-09a6900f-aaa3-49e3-beca-4826d573ea1b' { menuentry 'CentOS Linux (5.5.11-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-09a6900f-aaa3-49e3-beca-4826d573ea1b' { menuentry 'CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-1160.el7.x86_64-advanced-09a6900f-aaa3-49e3-beca-4826d573ea1b' { menuentry 'CentOS Linux (0-rescue-5411791349d54954a035bc94729a9bf8) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-5411791349d54954a035bc94729a9bf8-advanced-09a6900f-aaa3-49e3-beca-4826d573ea1b' {</code></pre> <h2>根据上面导出结果显示的的id,确定第几个ID值的内容确实第几个</h2> <pre><code>grub2-set-default 1</code></pre> <p>数字从 0 开始,即:第一个为 0;</p> <h1>附,操作命令</h1> <pre><code>查看/boot分区 df -H /boot 查看内核 rpm -qa|grep kernel 查看当前在用的内核 uname -r 删除不用的内核,一般会保留3个内核,多出来的会删除 rpm -e kernel-3.10.0-1160.el7.x86_64 安装新内核 rpm -ivh kernel-ml-5.5.11-1.el7.elrepo.x86_64.rpm 查看内核排序 cat /boot/grub2/grub.cfg |grep menuentry 确定使用哪个内核 grub2-set-default 0 第一个ID是从0开始 </code></pre>

页面列表

ITEM_HTML