Accidentally deleted yum.conf

Although I've no idea what was originally in your /etc/yum.conf, try placing this generic/vanilla content in there.

$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://b                                                                                                                     
ugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
$

If you prefer to restore to the original, you can reinstall the rpm that creates the yum.conf. First, find which rpm it comes from using rpm -qf.

On my system,

$ rpm -qf /etc/yum.conf 
yum-3.4.3-158.el7.centos.noarch

I found a copy here:

http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

To reinstall,

$ sudo rpm --reinstall http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

Alternatively, you could download the rpm, and pick it apart using rpm2cpio:

$ mkdir /tmp/yum
$ cd /tmp/yum
$ curl http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm | rpm2cpio | cpio -idmv

It will now be in /tmp/yum/etc/yum.conf

Meanwhile, you may wish to start using etckeeper, which will at least keep a local backup of your /etc in version control.

Tags:

Yum

Centos