How Do I Change the Kernel Version of CentOS 7 BMSs?
Scenarios
Some special software runs properly only on specified Linux kernel versions. This section describes how to change the kernel version.
Solution
- Log in to the BMS OS.
- Run the following command to check the current kernel version:
[root@xxxxxx~]# uname -r 3.10.0-327.22.2.el7.x86_64
- Run the following command to check the number of kernels in the OS:
cat /boot/grub2/grub.cfg | grep menuentry
[root@xxxxxx~]# cat /boot/grub2/grub.cfg | grep menuentry if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" menuentry_id_option="" export menuentry_id_option menuentry ´CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)´ --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option ´gnulinux-3.10.0-327.el7.x86_64-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97´ { menuentry ´CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)´ --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option ´gnulinux-3.10.0-327.el7.x86_64-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97´ { menuentry ´CentOS Linux (0-rescue-7d26c16f128042a684ea474c9e2c240f) 7 (Core)´ --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option ´gnulinux-0-rescue-7d26c16f128042a684ea474c9e2c240f-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97´ {
- Run the following command to set the kernel that is started by default, for example, CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core):
grub2-set-default "CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)"
- Run the following command to check the kernel that is started by default:
[root@xxxxxx~]# grub2-editenv list saved_entry=CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
- Restart the BMS, enter its OS, and run the command in step 2 to check whether the kernel has been changed.
[root@xxxxxx~]# uname -r 3.10.0-327.el7.x86_64
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.