centos Error: Cannot find a valid baseurl for repo: base 解决方法

参考 https://arstech.net/centos-6-error-yumrepo-error-all-mirror-urls-are-not-using-ftp-http/ 

【1】报错现场;

原因, 软件镜像地址有误,需要手工录入;

2、编辑文件, /etc/yum.repos.d/CentOS-Base.repo.

找到 base, updates, extras 域,并 注释掉 mirrorlist, baseurl; 

然后复制 baseurl做修改,如下:(注意我的centos 版本是6.5 ,所以需要做对应修改)

# CentOS-Base.repo
      2 #
      3 # The mirror system uses the connecting IP address of the client and the
      4 # update status of each mirror to pick mirrors that are updated to and
      5 # geographically close to the client.  You should use this for CentOS updates
      6 # unless you are manually picking other mirrors.
      7 #
      8 # If the mirrorlist= does not work for you, as a fall back you can try the
      9 # remarked out baseurl= line instead.
     10 #
     11 #
     12 
     13 [base]
     14 name=CentOS-$releasever - Base
     15 # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
     16 # baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
     17 baseurl=http://vault.centos.org/6.5/os/$basearch/
     18 gpgcheck=1
     19 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
     20 
     21 #released updates
     22 [updates]
     23 name=CentOS-$releasever - Updates
     24 # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
     25 # baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
     26 baseurl=http://vault.centos.org/6.5/updates/$basearch/
     27 gpgcheck=1
     28 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
     29 
     30 #additional packages that may be useful
     31 [extras]
     32 name=CentOS-$releasever - Extras
     33 # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
     34 # baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
     35 baseurl=http://vault.centos.org/6.5/extras/$basearch/
     36 gpgcheck=1
     37 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
     38 
     39 #additional packages that extend functionality of existing packages
     40 [centosplus]
     41 name=CentOS-$releasever - Plus
     42 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
     43 #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
     44 gpgcheck=1
     45 enabled=0
     46 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
     47 
     48 #contrib - packages by Centos Users
     49 [contrib]
     50 name=CentOS-$releasever - Contrib
     51 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
     52 #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
     53 gpgcheck=1
     54 enabled=0
     55 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

 

3、清空缓存

yum clean all 

4 更新  yum update 

bingo。 

 

 

 

 

你可能感兴趣的:(centos Error: Cannot find a valid baseurl for repo: base 解决方法)