Accidentally deleted yum.conf

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
13
down vote

favorite












I don't know what I was trying to do but I basically deleted yum.conf. I found an old config for yum on github but it still doesn't work. What do I do? I am using Centos 7.







share|improve this question









New contributor




pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 2




    Restore from your backup?
    – roaima
    Sep 7 at 9:00






  • 2




    "basically deleted yum.conf" - do you mean you deleted just that file or that you've mangled it beyond repair, or that you've deleted other files too, or that you've broken permissions? Please be precise in your question as it might be important for a correct solution.
    – roaima
    Sep 7 at 9:01







  • 1




    It is good manners to wait 24 hours before accepting an answer, to allow people from all timezones to get a chance.
    – loa_in_
    Sep 7 at 11:35






  • 2




    @loa_in_: you should tell that to the two users who encouraged OP to accept the answer.
    – Martin Argerami
    Sep 7 at 11:43






  • 4




    @loa_in_ no, it's good manners to accept a helpful answer that solves the problem. People from other timezones can have a crack at other questions, no point needlessly leaving stuff on the unanswered page.
    – hobbs
    Sep 7 at 13:49














up vote
13
down vote

favorite












I don't know what I was trying to do but I basically deleted yum.conf. I found an old config for yum on github but it still doesn't work. What do I do? I am using Centos 7.







share|improve this question









New contributor




pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 2




    Restore from your backup?
    – roaima
    Sep 7 at 9:00






  • 2




    "basically deleted yum.conf" - do you mean you deleted just that file or that you've mangled it beyond repair, or that you've deleted other files too, or that you've broken permissions? Please be precise in your question as it might be important for a correct solution.
    – roaima
    Sep 7 at 9:01







  • 1




    It is good manners to wait 24 hours before accepting an answer, to allow people from all timezones to get a chance.
    – loa_in_
    Sep 7 at 11:35






  • 2




    @loa_in_: you should tell that to the two users who encouraged OP to accept the answer.
    – Martin Argerami
    Sep 7 at 11:43






  • 4




    @loa_in_ no, it's good manners to accept a helpful answer that solves the problem. People from other timezones can have a crack at other questions, no point needlessly leaving stuff on the unanswered page.
    – hobbs
    Sep 7 at 13:49












up vote
13
down vote

favorite









up vote
13
down vote

favorite











I don't know what I was trying to do but I basically deleted yum.conf. I found an old config for yum on github but it still doesn't work. What do I do? I am using Centos 7.







share|improve this question









New contributor




pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










I don't know what I was trying to do but I basically deleted yum.conf. I found an old config for yum on github but it still doesn't work. What do I do? I am using Centos 7.









share|improve this question









New contributor




pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Sep 7 at 10:30









Jeff Schaller

32.1k849109




32.1k849109






New contributor




pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Sep 7 at 8:29









pcrunn

685




685




New contributor




pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






pcrunn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2




    Restore from your backup?
    – roaima
    Sep 7 at 9:00






  • 2




    "basically deleted yum.conf" - do you mean you deleted just that file or that you've mangled it beyond repair, or that you've deleted other files too, or that you've broken permissions? Please be precise in your question as it might be important for a correct solution.
    – roaima
    Sep 7 at 9:01







  • 1




    It is good manners to wait 24 hours before accepting an answer, to allow people from all timezones to get a chance.
    – loa_in_
    Sep 7 at 11:35






  • 2




    @loa_in_: you should tell that to the two users who encouraged OP to accept the answer.
    – Martin Argerami
    Sep 7 at 11:43






  • 4




    @loa_in_ no, it's good manners to accept a helpful answer that solves the problem. People from other timezones can have a crack at other questions, no point needlessly leaving stuff on the unanswered page.
    – hobbs
    Sep 7 at 13:49












  • 2




    Restore from your backup?
    – roaima
    Sep 7 at 9:00






  • 2




    "basically deleted yum.conf" - do you mean you deleted just that file or that you've mangled it beyond repair, or that you've deleted other files too, or that you've broken permissions? Please be precise in your question as it might be important for a correct solution.
    – roaima
    Sep 7 at 9:01







  • 1




    It is good manners to wait 24 hours before accepting an answer, to allow people from all timezones to get a chance.
    – loa_in_
    Sep 7 at 11:35






  • 2




    @loa_in_: you should tell that to the two users who encouraged OP to accept the answer.
    – Martin Argerami
    Sep 7 at 11:43






  • 4




    @loa_in_ no, it's good manners to accept a helpful answer that solves the problem. People from other timezones can have a crack at other questions, no point needlessly leaving stuff on the unanswered page.
    – hobbs
    Sep 7 at 13:49







2




2




Restore from your backup?
– roaima
Sep 7 at 9:00




Restore from your backup?
– roaima
Sep 7 at 9:00




2




2




"basically deleted yum.conf" - do you mean you deleted just that file or that you've mangled it beyond repair, or that you've deleted other files too, or that you've broken permissions? Please be precise in your question as it might be important for a correct solution.
– roaima
Sep 7 at 9:01





"basically deleted yum.conf" - do you mean you deleted just that file or that you've mangled it beyond repair, or that you've deleted other files too, or that you've broken permissions? Please be precise in your question as it might be important for a correct solution.
– roaima
Sep 7 at 9:01





1




1




It is good manners to wait 24 hours before accepting an answer, to allow people from all timezones to get a chance.
– loa_in_
Sep 7 at 11:35




It is good manners to wait 24 hours before accepting an answer, to allow people from all timezones to get a chance.
– loa_in_
Sep 7 at 11:35




2




2




@loa_in_: you should tell that to the two users who encouraged OP to accept the answer.
– Martin Argerami
Sep 7 at 11:43




@loa_in_: you should tell that to the two users who encouraged OP to accept the answer.
– Martin Argerami
Sep 7 at 11:43




4




4




@loa_in_ no, it's good manners to accept a helpful answer that solves the problem. People from other timezones can have a crack at other questions, no point needlessly leaving stuff on the unanswered page.
– hobbs
Sep 7 at 13:49




@loa_in_ no, it's good manners to accept a helpful answer that solves the problem. People from other timezones can have a crack at other questions, no point needlessly leaving stuff on the unanswered page.
– hobbs
Sep 7 at 13:49










2 Answers
2






active

oldest

votes

















up vote
17
down vote



accepted










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
$





share|improve this answer




















  • While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
    – nrolans
    yesterday

















up vote
7
down vote













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.






share|improve this answer


















  • 1




    Etckeeper is litteraly the very first thing I install on a new system.
    – hlovdal
    Sep 8 at 17:23










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






pcrunn is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467474%2faccidentally-deleted-yum-conf%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
17
down vote



accepted










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
$





share|improve this answer




















  • While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
    – nrolans
    yesterday














up vote
17
down vote



accepted










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
$





share|improve this answer




















  • While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
    – nrolans
    yesterday












up vote
17
down vote



accepted







up vote
17
down vote



accepted






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
$





share|improve this answer












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
$






share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 7 at 8:32









steve

12.9k22149




12.9k22149











  • While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
    – nrolans
    yesterday
















  • While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
    – nrolans
    yesterday















While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
– nrolans
yesterday




While this technically fixes the issue, it is also potentially unsafe. Copying entire critical config files from non-authoritative sources (with all due respect) should generally not be encouraged. It could also easily be incompatible with other versions of yum (older or newer). Reinstalling the correct package or at least fetching the file from it via a trusted source is a more sensible approach and applies to other pkgs.
– nrolans
yesterday












up vote
7
down vote













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.






share|improve this answer


















  • 1




    Etckeeper is litteraly the very first thing I install on a new system.
    – hlovdal
    Sep 8 at 17:23














up vote
7
down vote













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.






share|improve this answer


















  • 1




    Etckeeper is litteraly the very first thing I install on a new system.
    – hlovdal
    Sep 8 at 17:23












up vote
7
down vote










up vote
7
down vote









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.






share|improve this answer














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.







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 7 at 19:54

























answered Sep 7 at 15:49









rrauenza

36116




36116







  • 1




    Etckeeper is litteraly the very first thing I install on a new system.
    – hlovdal
    Sep 8 at 17:23












  • 1




    Etckeeper is litteraly the very first thing I install on a new system.
    – hlovdal
    Sep 8 at 17:23







1




1




Etckeeper is litteraly the very first thing I install on a new system.
– hlovdal
Sep 8 at 17:23




Etckeeper is litteraly the very first thing I install on a new system.
– hlovdal
Sep 8 at 17:23










pcrunn is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















pcrunn is a new contributor. Be nice, and check out our Code of Conduct.












pcrunn is a new contributor. Be nice, and check out our Code of Conduct.











pcrunn is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467474%2faccidentally-deleted-yum-conf%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

One-line joke