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。 

 

 

 

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值