海康的centos源未启用

0

你当前使用的是 CentOS 7.6.1810,但系统中 所有的 YUM 仓库都处于 disabled 状态,所以 yum update 才会提示 “There are no enabled repos”。

✅ 最快解决方式:使用阿里云 CentOS 7 源(推荐)

你可以使用以下命令来替换为可用的阿里云镜像源,并立即启用它:

# 备份旧的 repo 文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

# 下载阿里云 CentOS 7 的 repo 文件
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

# 清除缓存并重新生成缓存
yum clean all
yum makecache

然后你就可以使用:

yum repolist
yum update -y

🔍 如果你没有联网(或者仅有本地镜像):

你只能通过本地挂载 ISO、启用 c7-media 仓库来使用 YUM:

yum-config-manager --enable c7-media
yum repolist

但这通常是应急使用,一般建议联网用国内镜像源(速度快、维护活跃)。


✳️ 补充说明:

你之前看到的 C7.4.1708-xxxC7.5.1804-xxx 等是历史遗留版本分支,且都被禁用了,现在主流做法是使用统一的 CentOS 7 源(Base、Updates、Extras 等),阿里云源已经为你处理好了这些细节。


如需我帮你自动化配置,以下是完整脚本:

#!/bin/bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum repolist

执行完后你再运行:

yum update

应该就一切正常了 ✅。如果你还遇到报错,也可以贴出来我继续帮你看。