Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Oct 19 '11 at 11:11

This question came from our site for professional and enthusiast programmers.

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

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

share|improve this answer
2  
Perfect. sudo dhclient fixed it ! Thanks. – xbsd Nov 24 '15 at 21:16

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

ONBOOT=no
NM_CONTROLLED=no
BOOTPROTO=dhcp
DNS1=8.8.8.8
DNS2=4.2.2.2

restart the network interface

ifdown eth0
ifup eth0

Hope this help

share|improve this answer
    
ifcfg-eth0 does not exist on CentOs 7 – shailenTJ Jan 31 '15 at 18:31
    
@shailenTJ Just touch it ~ works fine. – Eddie B Sep 5 '15 at 7:01
    
@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 Dec 15 '15 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. – Chris Dutrow Apr 14 at 5:00

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.

proxy=http://xxx.xxx.xx.xx:8080

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

proxy_username=username
proxy_password=password
share|improve this answer

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

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
share|improve this answer

Try adding these entries to /etc/resolv.conf:

nameserver 8.8.8.8
nameserver 8.8.4.4
share|improve this answer

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

Delete all the content of 'remi.repo' file and then execute

# yum update

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

share|improve this answer
    
Where is this remi.repo file located? – user28377 Dec 6 '12 at 11:04
    
/etc/yum.repos.d/ – Steven Kryskalla Feb 6 '13 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 May 14 '13 at 22:21

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.

share|improve this answer

protected by Community Oct 14 '14 at 17:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?