How to update system without updating Linux kernel in CentOS

Time:2020-10-16

Today, I used the cloud server of ucloud

Copy code

The code is as follows:

yum upgrade -y

And then after the restart, my machine won’t connect.

After communicating with customer service personnel, it is found that the kernel cannot be updated when it is updated.

In fact, the method is also very simple. When updating, use the following command

Copy code

The code is as follows:

yum -y –exclude=kernel\* upgrade

perhaps

Copy code

The code is as follows:

yum -y -x ‘kernel*’ upgrade

Of course, it can also be written to the configuration file once and for all.

Copy code

The code is as follows:

vim /etc/yum.conf

Write the following information

Copy code

The code is as follows:

exclude=kernel*

It’s done. Mom doesn’t have to worry about updating the system.

There are many ways to view the kernel version:
1. Direct cat version information

Copy code

The code is as follows:

[[email protected] ~]$ cat /proc/version
Linux version 2.6.18-238.el5 ([email protected]centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 15:51:15 EST 2011

2. Use the system command to view

Copy code

The code is as follows:

[[email protected] ~]$ uname -a
Linux hexuweb102 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

3. Direct cat version information

Copy code

The code is as follows:

[[email protected] ~]$ cat /proc/version
Linux version 2.6.18-238.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 15:51:15 EST 2011

4. Use the system command to view

Copy code

The code is as follows:

[[email protected] ~]$ uname -a
Linux hexuweb102 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

If you are not sure, you can compare them to ensure that the kernel version before and after the update is consistent~