在使用 CentOS 的时候,因为为了方便我经常会将 CentOS 自带的 repo 全都删掉(不好的习惯),但是,当我需要它们的时候,我得从其他干净得机器上去拷贝回来,我觉得有点麻烦,所以就找了一下如何恢复这些 repo,其实也很简单:

有人介绍了一个快速的方法:

[[email protected]]# yum reinstall centos-release

但是,我的 repo 都被清空了,那里去 reinstall 呢?所以这个对我来说不行,得找个离线的方式:

[[email protected]]# yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-6.1810.2.el7.centos.x86_64.rpm

这样就可以了。

你还可以在 http://mirror.centos.org/centos 中找到各种不同 CentOS 版本的对应 repo。

Reference