有时候我们在通过SSH工具进行yum命令安装的时候,会遇到类似的报错,如下:Repository epel is listed more than once in the configuration到底是哪里出了问题,每次都显示这个提示,总感觉不爽。这里搬主题的测试环境为CentOS 7,主机为阿里云的。接下来分享了Repository epel is listed more than once in the configuration报错的解决方案。解决方案:1、首先cd进入对应的目录,然后打包/etc/yum.repos.d/目录下的所有文件,以备恢复使用,运行命令:zip centos7-repo.zip /etc/yum.repos.d/* ,如下图2、打包完毕,再运行ls命令查看多了一个zip文件,正是我们打包的文件[root@xx_0_15_centos yum.repos.d]# ls
centos7-repo.zip CentOS-Base.repo CentOS-Epel.repo epel.repo epel-testing.repo
[root@xx_0_15_centos yum.repos.d]# 3、删除多余文件,运行rm -rf !(centos7-repo.zip)命令,意思是删除除.zip文件以外的所有文件,再次ls查看已经都删除了4、到阿里开源镜像站点下载系统对应版本的repo文件,运行wget http://mirrors.aliyun.com/repo/CentOS-7.repo命令下载完后再次查看已经多出来一个CentOS-7.repo文件,再次运行命令清空缓存,重建缓存。yum clean all
yum makecache如下图这时报错Repository epel is listed more than once in the configuration已经修复。
THE END