Files
Linux/问题记录/Centos在加载YUM源时显示已存在.md
2026-09-17 22:29:26 +08:00

27 lines
818 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> 本文作者:丁辉
# Centos在加载YUM源时显示已存在
当我们加载 YUM 源时,提示我们源已存在,但这时我们的 `/etc/yum.repos.d/` 下并没有加载的 repo 文件这时我们可以尝试主动清理并重新加载 YUM 源,从 RPM 数据库中移除这个 “幽灵” 包记录。(因为时加载Centos内核文件时遇到的问题,下面我们就拿此举例)
1. 执行卸载命令
```bash
rpm -e --nodeps elrepo-release
```
**解释**
`-e` 是卸载,--nodeps 忽略依赖检查。这一步不会删除任何文件(因为文件本来就不存在),但它会清除 RPM 数据库中的记录,告诉系统“这个包没安装过”。
2. 查看结果
```bash
rpm -qa | grep elrepo
```
如果没有任何输出,说明清理成功。