Rebuild your the default CentOS yum.repo.d folder

On a dev machine, somehow, I managed to erase my yum.repo.d contents. I wanted to rebuild the repo files back to their default. First you need to figure out what version you are using:

  • cat /etc/redhat-release

Then visit the correct release at : http://vault.centos.org/

  • navigate to the correct os/x86_64/CentOS/ directory (could be os/x86_64/CentOS/ i386/)
  • Download the following files to the server:
    • wget http://vault.centos.org/5.x/os/x86_64/CentOS/centos-release-notes-5.x-0.x86_64.rpm
    • wget http://vault.centos.org/5.x/os/x86_64/CentOS/centos-release-5-x.el5.centos.x86_64.rpm
  • Then install the two rpms:
    • rpm -Uivh *.rpm
Should be back to the original shipping repo files.

One Response to Rebuild your the default CentOS yum.repo.d folder

  1. anton December 5, 2015 at 5:30 am #

    im new centos user , i kinda messed up my repo.d content..so i followed this step but i got error bellow

    warning: group mockbuild does not exist – using root
    warning: user mockbuild does not exist – using root

    can you help me?