How can I fix "cannot find a valid baseurl for repo" errors on CentOS?
I finished installing CentOS 6, but when I tried running
yum updateI got:
[[email protected] ~]# 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?
First you need to get connected, AFAIK CentOS 6 minimal set your network device to
ONBOOT=No, just do a
dhclientwith admin privileges to your network interface and you should be up and running:
$ sudo dhclient
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.
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.