修复缺少 Kernel-Headers on CentOS 7,导致 gcc glibc-headers安装失败

问题:

--> Finished Dependency Resolution
--> Finding unneeded leftover dependencies
Found and removing 0 unneeded dependencies
Error: Package: glibc-headers-2.17-323.el7_9.x86_64 (updates)
           Requires: kernel-headers >= 2.2.1
Error: Package: glibc-headers-2.17-323.el7_9.x86_64 (updates)
           Requires: kernel-headers
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

  

解决:

刚开始以为是yum源的问题,换了阿里源之后发现安装gcc还是失败,当时简单执行了 yum install kernel-headers 发现 Nothing to do,最后在国外一篇博客看到处理方式尝试后解决了问题。

$ yum install kernel-headers --disableexcludes=all

disableexcludes 选项解释: https://www.cnblogs.com/dream397/p/13086679.html  

If the above solution doesn’t work well on your CentOS 7 server, you can follow other solutions below.

1.) First of all, we need to edit the yum.conf file under the /etc/ directory. Because your CentOS 7 system is most likely to exclude kernel packages, so we need to fix this.

$ nano /etc/yum.conf

2.) Please look for the exclude=kernel line, well we need to comment or delete this line.

Change from:

$ exclude=kernel*

To:

$ #exclude=kernel*

3.) Finally, let’s install kernel-headers on your CentOS 7 system.

$ yum install kernel-headers
原文地址:https://www.cnblogs.com/morse/p/14476783.html