CentOS7安装EPEL后yum提示仓库重复配置问题求助
Hey there, let's get that annoying duplicate repo error sorted out quickly. Here's a step-by-step breakdown to fix it:
1. Identify the duplicate repo entry
First, let's pin down exactly where the duplicate epel repository is defined. Run this command to list all EPEL-related repo IDs and their associated files:
sudo yum-config-manager --list | grep -A5 -B5 epel
This output will show you every repo entry linked to EPEL, including which .repo file it originates from. Keep an eye out for the same repo id (specifically epel) appearing multiple times.
Alternatively, you can check the contents of each repo file directly to spot duplicates:
# Inspect epel.repo cat /etc/yum.repos.d/epel.repo # Inspect epel-testing.repo cat /etc/yum.repos.d/epel-testing.repo # Inspect localc7.repo cat /etc/yum.repos.d/localc7.repo
Look for duplicate [epel] sections across these files (or even within a single file).
2. Disable the duplicate entry
Once you've found the duplicate, you have two straightforward options to fix it:
Option A: Use yum-config-manager to disable it
If the duplicate repo has a unique ID (or you want to toggle off the extra one), run:
sudo yum-config-manager --disable <duplicate-repo-id>
For example, if the duplicate comes from localc7.repo and its repo ID is epel-local, you'd run:
sudo yum-config-manager --disable epel-local
Use the output from step 1 to get the exact repo ID if you're unsure.
Option B: Edit the repo file directly
Open the problematic .repo file with a text editor like nano or vi:
sudo nano /etc/yum.repos.d/[problem-file].repo
Find the duplicate [epel] section, then either:
- Change
enabled=1toenabled=0to disable it, or - Delete the entire duplicate section (just double-check you don't remove the original valid entry!)
Save the file and exit the editor when done.
3. Verify the fix
Run this command to confirm the error is resolved:
yum repolist all
You should no longer see the "Repository epel is listed more than once" message. If everything looks good, test with a command like yum update to ensure yum functions normally again.
内容的提问来源于stack exchange,提问作者ted

