在/etc/yum.repos.d
中创建repo.disabled
[root@centos ~]# mkdir /etc/yum.repos.d/repo.disabled
[root@centos ~]# ls /etc/yum.repos.d/
centos.repo centos.repo centos-updates.repo centos-updates-testing.repo
repo.disabled
然后将所有这些 3 回购文件移动到 repo.disabled 文件夹:
[root@centos ~]# mv /etc/yum.repos.d/centos.repo/etc/yum.repos.d/repo.disabled
[root@centos ~]# mv /etc/yum.repos.d/centos-updates.repo/etc/yum.repos.d/repo.disabled
[root@centos ~]# mv /etc/yum.repos.d/centos-updates-testing.repo/etc/yum.repos.d/repo.disabled
列出 /etc/yum.repos.d 中更新的文件和文件夹:
[root@centos ~]# ls -l /etc/yum.repos.d/
total 8
-rw-r--r--. 1 root root 92 Aug 18 00:09 centos.repo
drwxr-xr-x. 2 root root 4096 Aug 18 11:27 repo.disabled
注意:只有文件 centos.repo 和文件夹 repo.disabled 应该存在。
现在你必须运行 yum clean all 来清除缓存,一切都会正常工作。
[root@centos ~]# yum clean all