yum installs kernel-devel different from my kernel version

You can install the correct kernel header files like so:

$ sudo yum install "kernel-devel-uname-r == $(uname -r)"

Example

This command will always install the right version.

$ sudo yum install "kernel-devel-uname-r == $(uname -r)"
Loaded plugins: auto-update-debuginfo, changelog, langpacks, refresh-packagekit
No package kernel-devel-uname-r == 3.12.6-200.fc19.x86_64 available.
Error: Nothing to do

Or you can search for them like this:

$ yum search "kernel-headers-uname-r == $(uname -r)" --disableexcludes=all
Loaded plugins: auto-update-debuginfo, changelog, langpacks, refresh-packagekit
Warning: No matches found for: kernel-headers-uname-r == 3.12.6-200.fc19.x86_64
No matches found

However I've notice this issue as well where specific versions of headers are not present in the repositories. You might have to reach into Koji to find a particular version of a build.

  • Information for build kernel-3.12.6-200.fc19

That page includes all the assets for that particular version of the Kernel.


Distribution Synchronization

Your problem could be "distribution synchronization". Running this command solved my problem.

yum distro-sync

Synchronizes the installed package set with the latest packages available, this is done by either obsoleting, upgrading or downgrading as appropriate. (http://man7.org/linux/man-pages/man8/yum.8.html)


You can install a specific version of a package by specifying the version along with the package name with yum. For example, to install the kernel development files for the specific kernel you're running, type

yum install kernel-devel-3.9.5-301.fc19

You can do a similar command to get the right kernel-headers package.