When using CENTOS 7 with Kernel 4.5, I can not yum install kernel-headers with the same kernel version. I am stuck on 3.10, which is what Centos comes with. How can I install Kernel-headers 4.5 and Kernel-devel which is needed for compiling drivers?

The packages are not in a repo with the mainline kernel updates:

[root@localhost tmp]# yum list | grep kernel
kernel-ml.x86_64                        4.5.0-1.el7.elrepo             @elrepo-kernel
abrt-addon-kerneloops.x86_64            2.1.11-36.el7.centos           base     
erlang-kernel.x86_64                    R16B-03.16.el7                 epel     
kernel.x86_64                           3.10.0-327.13.1.el7            updates  
kernel-abi-whitelists.noarch            3.10.0-327.13.1.el7            updates  
kernel-debug.x86_64                     3.10.0-327.13.1.el7            updates  
kernel-debug-devel.x86_64               3.10.0-327.13.1.el7            updates  
kernel-devel.x86_64                     3.10.0-327.13.1.el7            updates  
kernel-doc.noarch                       3.10.0-327.13.1.el7            updates  
kernel-headers.x86_64                   3.10.0-327.13.1.el7            updates  
kernel-tools.x86_64                     3.10.0-327.13.1.el7            updates  
kernel-tools-libs.x86_64                3.10.0-327.13.1.el7            updates  
kernel-tools-libs-devel.x86_64          3.10.0-327.13.1.el7            updates  
libreport-plugin-kerneloops.x86_64      2.1.11-32.el7.centos           base     
lirc-disable-kernel-rc.x86_64           0.9.1a-4.el7                   epel     
php-symfony-http-kernel.noarch          2.7.10-1.el7                   epel     
texlive-l3kernel.noarch                 2:svn29409.SVN_4469-38.el7     base     
texlive-l3kernel-doc.noarch             2:svn29409.SVN_4469-38.el7     base     
[root@localhost tmp]# uname -a
Linux localhost.localdomain 4.5.0-1.el7.elrepo.x86_64 #1 SMP Mon Mar 14 10:24:58 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost tmp]# 
  • You install the headers from elrepo, of course. – Michael Hampton Apr 8 '16 at 0:55
  • I can not install from the el-repo, these packages are not there: see edit – user1955162 Apr 8 '16 at 1:03
  • Looks like you disabled the elrepo repo. Try enabling it again. – Michael Hampton Apr 8 '16 at 1:06

Did you notice that the name of the kernel package you installed was kernel-ml?

Corresponding to that, you need to install kernel-ml-devel to get the corresponding kernel source for compiling drivers against your kernel.

You don't need to install any kernel headers other than this.

  • No package kernel-ml-devel available. -- and kernel-headers is a requirement of gcc, is it not? Yum tries to install kernel-headers 3.10 – user1955162 Apr 8 '16 at 1:07
  • Then you need to re-enable the repo, as I already said! – Michael Hampton Apr 8 '16 at 1:07
  • I don't understand, as I didn't disable it when following a guide to enable it in the first place. I see now that those packages are enabled, will gcc take kernel-ml-headers? – user1955162 Apr 8 '16 at 1:10
  • I guess when i installed kernel-ml it used the repo through the --enablerepo flag. actually enabling the repo fixed the issue of installing kernel-ml development packages, and for those looking to an answer, yes: gcc will take kernel-ml-headers. – user1955162 Apr 8 '16 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.