CentOS7.6中kernel-devel-3.10.0-957.el7.x86_64包缺失,能否不升级内核修复
Absolutely, you don't have to upgrade your kernel to resolve this issue! The root problem is that the kernel-devel package matching your current kernel version (3.10.0-957.el7.x86_64) isn't available in your enabled YUM repositories—this often happens because older CentOS 7 package versions get moved to the CentOS Vault archive once newer releases come out.
Here are three actionable solutions you can try:
1. Enable the CentOS Vault repository
CentOS Vault stores older versions of packages that are no longer in the main repositories. Here's how to switch to it temporarily:
# First, back up your current repo configuration to avoid breaking things cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak # Modify the repo file to point to the CentOS 7.6 Vault archive sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Base.repo sed -i 's/#baseurl/baseurl/g' /etc/yum.repos.d/CentOS-Base.repo sed -i 's/\/centos\/7\//\/centos-vault\/7.6.1810\//g' /etc/yum.repos.d/CentOS-Base.repo # Now try installing the matching kernel-devel package again yum install -y "kernel-devel-$(uname -r)"
Once you're done, you can restore your original repo config by running cp /etc/yum.repos.d/CentOS-Base.repo.bak /etc/yum.repos.d/CentOS-Base.repo to get back to normal system updates.
2. Manually download and install the kernel-devel RPM
If you don't want to mess with repo configurations, you can directly grab the exact RPM package from the Vault:
# Download the matching kernel-devel package for your version wget http://vault.centos.org/7.6.1810/os/x86_64/Packages/kernel-devel-3.10.0-957.el7.x86_64.rpm # Install the package locally rpm -ivh kernel-devel-3.10.0-957.el7.x86_64.rpm
Double-check the URL to make sure it matches your kernel version—you can browse the Vault archive to confirm the correct path if needed.
3. Check for other enabled repositories
Sometimes third-party or local mirror repositories might still host the older kernel-devel package. Run this command to search all enabled repos for the package:
yum provides kernel-devel-3.10.0-957.el7.x86_64
If the command returns a repository that has the package, make sure that repo is enabled (you can check repo status with yum repolist enabled) and then try the install command again.
All these methods let you get the matching kernel-devel package without upgrading your kernel. Just pick the one that fits your workflow best!
内容的提问来源于stack exchange,提问作者roamer

