I finished installing CentOS 6, but when I tried running yum update I got:

[root@centos6test ~]# yum update
Loaded plugins: fastestmirror, refresh-packagekit
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os
error was 14: PYCURL ERROR 6 - "" Error: Cannot find a valid baseurl for repo: base

Why is that happening? How can I fix it?

  • 3
    Are you connected to the network? Can you ping mirrorlist.centos.org? Commented Dec 4, 2011 at 8:51
  • 3
    What happens if you run curl 'http://mirrorlist.centos.org/?release=6&arch=i386&repo=os' ?
    – rvs
    Commented Jan 3, 2012 at 9:09

12 Answers 12


First you need to get connected, AFAIK CentOS 6 minimal set your network device to ONBOOT=No, just do a dhclient with admin privileges to your network interface and you should be up and running:

$ sudo dhclient

  • 1
    I used to setup dhcp client on my remote server using ssh according to this answer and now I lost the connection because server IP is dynamically changed now and I was not thinking of that case before applying changes. This answer is fallacious without enough description and leads to misunderstandings. Commented Apr 26, 2017 at 4:33
  • 6
    For CentOS-7 (1611) version, the ONBOOT=No is located in a file like /etc/sysconfig/network-scripts/ifcfg-enp0s3. I edited that file to ONBOOT=yes and reboot can fix it. Commented May 10, 2017 at 7:21
  • 3
    Changing to ONBOOT=yes in /etc/sysconfig/network-scripts/ifcfg-enp0s3 works for me, thanks @JohnnyWong
    – Evi Song
    Commented Sep 18, 2017 at 3:09

I had been struggling with the same problem on Centos6.4 x86_64. I got the following error :

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'" Error: Cannot find a valid baseurl for repo: base

So, I fixed it by these steps:

edit network interface. For my case, I used eth0 in CentOS 6.X In CentOS 7 you can use the "ensxxx" interface.

vim /etc/sysconfig/network-scripts/ifcfg-eth0

update NM_CONTROLLED to no


restart the network interface

ifdown eth0
ifup eth0
  • 2
    ifcfg-eth0 does not exist on CentOs 7
    – Shailen
    Commented Jan 31, 2015 at 18:31
  • @shailenTJ Just touch it ~ works fine. Commented Sep 5, 2015 at 7:01
  • 1
    @shailenTJ They changed the naming system, it'll be enpXsX, on my system it's enp0s3, but it will probably be slighty different on yours.
    – MarcusJ
    Commented Dec 15, 2015 at 14:32
  • If you do "minimal install", its "ifcfg-enpls0f0". But if you install with a GUI, it overrides that file with something else. Then you use the network settings tool at the top right corner of the main desktop screen. Commented Apr 14, 2016 at 5:00
  • probably isn't the DNS entry you want!
    – Dolph
    Commented Sep 12, 2019 at 18:55

I had the same issue and it got resolved after I edited /etc/yum.conf file. If you are running on proxy server and the IP which is given to the server is bypassed but still when you open in browser (IE - we need to give check mark on proxy but no need to give username and password.)

Add this following line in the main section of the file /etc/yum.conf file.


ie, substituting the proxy address with actual proxy. Also change the port number if it is not 8080.

If proxy requires authentication, add this also to the file


I edited the file /etc/yum.repos.d/CentOS-Base.repo and uncommented baseurl:

name=CentOS-$releasever - Base
  • 2
    Thanks! This worked for me. Does anyone know why this is needed, or why it was commented out if it is needed?
    – Rich
    Commented Sep 18, 2017 at 13:22

If pinging a well known host by its name (e.g. ping www.google.com) returns ping: unknown host but pinging an ip (e.g. ping works fine then you have a DNS resolution issue -- try adding these entries to /etc/resolv.conf:


Happened to me on CentOS 6 as it has reached end-of-life due to which no mirrors work now. Though you can use Vault repo where everything has been moved.

For CentOS 6, do:

curl https://www.getpagespeed.com/files/centos6-eol.repo --output /etc/yum.repos.d/CentOS-Base.repo

or take a look here.
This should fix up yum.


I had the same problem yesterday and I spent hours trying to solve it. The solution ended up being simple.

Delete the contents of /etc/yum.repos.d/remi.repo and then execute

# yum update

It's done! The file's content will start the download again and be configured.

  • Where is this remi.repo file located?
    – user28377
    Commented Dec 6, 2012 at 11:04
  • /etc/yum.repos.d/ Commented Feb 6, 2013 at 20:40
  • I may have miss something, but where do you see he has the Remi's repo installed ? He clearly mentioned 'I finished installing CentOS6', I kind of doubt Remi's repo are configured. I might be wrong...
    – Spredzy
    Commented May 14, 2013 at 22:21
  • The issue is a malformed file under /etc/yum.repos.d - remi.repo just happened to be the filename in this case Commented Jun 24, 2019 at 17:40

Here's yet another possibility that I stumbled upon, causing this problem:

I was using a Puppet module to create the EPEL repo for CentOS, the stahnma/epel module.

Within the module it constructed the repo URL with the variable ::os_maj_version which didn't exist in my list of facts. I had to replace that with ::operatingsystemmajrelease.

So the URL in /etc/yum.repos.d/epel.repo was malformed.


It happened to me on a Centos 7 environment, and I was able to solve it with the following command:

yum clean all

I had not run any yum command for a few months, seems like the cached metadata got obsolete.


All previous answers are correct but unfortunately did not work for me. The below command worked for me:

Warning this will delete all of you Centos repos !!! use this at your own risk

mkdir ~/backup
cp -r /etc/yum.repos.d/Cen* ~/backup
rm /etc/yum.repos.d/Cen*
  • this will delete repo from system Commented Apr 22, 2019 at 15:01
  • 2
    You should probably consider including the procedure to recreate the deleted repository files once you have deleted them all.
    – Kusalananda
    Commented Jun 2, 2019 at 11:31

My user's problem was simpler. He needed an extra repo added, so I copied my entry to him in a chat window. He added it to the repo file and got the error in the subject. After some playing around I deleted the new entry, copied and pasted an existing entry from within his own file and then edited the changes to reflect the added repo. It worked fine.

So the problem was some sort of formatting error caused by the way he copied and pasted the content into the file.


I had a slightly different error on our CentOS 7. I followed one of the suggestions and fixed it.

The error is:

$ sudo yum update mesa-libgbm


Could not retrieve mirrorlist https://mirrors.iuscommunity.org/mirrorlist?repo=ius-centos7&arch=x86_64&protocol=http error was
14: curl#6 - "Could not resolve host: mirrors.iuscommunity.org; Name or service not known"

 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:


     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...


Cannot find a valid baseurl for repo: ius/x86_64

I tried again using the 3rd suggestion and it worked.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .