Users can use uname -r to view the current kernel version.
Use yum list | grep kernel-headers to check whether the version of kernel-headers in the current yum repository is consistent with the kernel version.
If they are consistent, directly yum install kernel-headers
If they are different, perform manual installation and download the corresponding package, such as downloading kernel-headers-3.10.0-327.el7.x86_64.rpm (http://pkgs.org/centos-7/centos-x86_64/kernel-headers -3.10.0-327.el7.x86_64.rpm.html)
Then go to the directory where the file is located and execute rpm -ivh kernel-headers-3.10.0-327.el7.x86_64.rpm in the terminal.
kernel-headers Download (RPM, TXZ): http://pkgs.org/download/kernel-headers
The above is the operation method for installing kernel header files on CentOS. After checking the current kernel version of the system, you can choose one of the methods to install the kernel header files.