How to rebuild /etc/yum.repos.d in CentOS


If you remove all the files in /etc/yum.repos.d you may see this error. You can restore using the way below.

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>
[22:09][~]# cat /etc/redhat-release
 CentOS Linux release 7.3.1611 (Core)

Check your version and reinstall using this way.

[22:09][~]# yum reinstall http://vault.centos.org/7.3.1611/os/x86_64/Packages/centos-release-7-3.1611.el7.centos.x86_64.rpm


Tags:

2 thoughts on “How to rebuild /etc/yum.repos.d in CentOS”

  1. Maybe you know what is the proper link to .rpm for Red Hat Enterprise Linux release 8.0 (Ootpa)?

  2. How to rebuild it on Red Hat Enterprise Linux release 8.0 (Ootpa)? I’m testing this OS on AWS EC2 and this is my lab excercise :)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.