关于yum update与yum upgrade
事情是这么个事情;我给数据组的同事发放的ECS;我的模板是centso7.5-1804版本的;然后他们做测试,突然说内核版本不对了;
于是扯皮很久,我就找他们要了他们的操作记录,由于是root,所以文件是/root/.bash_history
#ll -a |grep his -rw-------. 1 root root 15700 Dec 22 09:38 .bash_history #tail .bash_history
背景:使用yum update命令 来进行升级包,但是他们没有加包名,导致内核也进行了升级;正确用法:yum update <package_name>;
使用uname -a命令来查看内核版本
#uname -a Linux ecs-drs-test.novalocal 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux #cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core)
#uname -a
Linux node196 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
#cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
然后我从晚上查阅了一些资料修改以下虚拟机默认启动内核
#rpm -qa kernel kernel-3.10.0-862.el7.x86_64 kernel-3.10.0-1160.49.1.el7.x86_64 #查看内核的设置 #grub2-editenv list saved_entry=CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core) #设置默认启动内核 #grub2-set-default 'CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)'
#uname -sr
Linux 3.10.0-862.el7.x86_64
#cat /boot/grub2/grub.cfg | grep -v rescu |grep ^men
menuentry 'CentOS Linux (3.10.0-1160.49.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.el7.x86_64-advanced-e1b5bf9e-66ac-44ab-b5fb-a6af278c76c4' {
menuentry 'CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.el7.x86_64-advanced-e1b5bf9e-66ac-44ab-b5fb-a6af278c76c4' {
#reboot
到此默认的启动内核修改完成;
最后,温馨提示;不要使用yum upgrade 命令,这个命令会覆盖源进行更新,就再也回不去了,有类似rm -rf的酸爽快感。