2
votes

All of the files were removed from /etc/yum.repos.d/ directory. How can I go about re-installing the default repos files that come with a fresh CentOS 7 install.

When I execute the following command "yum repolist all" I get the following result:

Loaded plugins: fastestmirror, landpacks
Loading mirror speeds from cached hostfile
repolist: 0

Thank you.

1

1 Answers

0
votes

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.

Credit: By jbmurphy on July 8, 2011 in Linux Reference - http://www.jbmurphy.com/2011/07/08/rebuild-your-the-default-centos-yum-repo-d-folder/