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

问题:

1
2
3
4
5
6
7
8
9
--> 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,最后在国外一篇博客看到处理方式尝试后解决了问题。

1
$ 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

 

posted @   Hall·Morse  阅读(851)  评论(0编辑  收藏  举报
编辑推荐:
· .NET 9 new features-C#13新的锁类型和语义
· Linux系统下SQL Server数据库镜像配置全流程详解
· 现代计算机视觉入门之:什么是视频
· 你所不知道的 C/C++ 宏知识
· 聊一聊 操作系统蓝屏 c0000102 的故障分析
阅读排行:
· DeepSeek V3 两周使用总结
· 回顾我的软件开发经历(1)
· C#使用yield关键字提升迭代性能与效率
· 低成本高可用方案!Linux系统下SQL Server数据库镜像配置全流程详解
· 4. 使用sql查询excel内容
点击右上角即可分享
微信分享提示