To install kernel headers on CentOS Linux to build VMware or other third-party modules, you will need to have root access or superuser privileges.
uname -r
This will display the version of your kernel. Make note of the version, as you will need it to install the correct kernel headers.
kernel-version with the version of your kernel:sudo yum install kernel-devel-kernel-version
For example, if your kernel version is 4.18.0-193.el8.x86_64, you would run the following command:
sudo yum install kernel-devel-4.18.0-193.el8.x86_64
This will install the kernel headers for your specific kernel version.
Note: If you are using a version of CentOS that uses the
dnfpackage manager instead ofyum, you can usednfto install the kernel headers by running the following command:
sudo dnf install kernel-devel-kernel-version
Replace kernel-version with the version of your kernel as before.