Linux:Cannot find a valid baseurl for repo:base

一、在使用CentOS 6.5的图形化界面时,突然蹦出这个界面:

在这里插入图片描述
这个问题一开始我遗留了很久没有解决,查了很多方式,包括把/etc/yum.repos.d/CentOS-Base.repo 改成备份等等方式。最终我在看书的时候,发现了这个问题的解决方案。

二、CentOS-Base.repo配置文件学习
1.这个是yum源的配置文件,其中以base为例:
	[base]:代表软件库的名字!中括号一定要存在,里面的名称则可以随意取。但是不能有 两个相同的软件库名称, 否则 yum 会不晓得该到哪里去找软件库相关软件清单文件。
    name:只是说明一下这个软件库的意义而已,重要性不高! mirrorlist=:列出这个软件库可以使用的映射站台,如果不想使用,可以注解到这行;
    baseurl=:这个最重要,因为后面接的就是软件库的实际网址! mirrorlist 是由 yum 程序 自行去捉映射站台, baseurl 则是指定固定的一个软件库网址!我们刚刚找到的网址放到 这里来啦! enable=1:就是让这个软件库被启动。如果不想启动可以使用 enable=0 喔! 
    gpgcheck=1:还记得 RPM 的数码签章吗?这就是指定是否需要查阅 RPM 文件内的数 码签章! 
	gpgkey=:就是数码签章的公钥档所在位置!使用默认值即可
三、问题解决:针对各个CentOS版本修改CentOS-Base.repo文件
注意在修改前做好该配置文件的备份!!!
注意修改完成后运行yum makecache生成元数据缓存!!!

CentOS 6:
/etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
	#The mirror system uses the connecting IP address of the client and the
#update status of each mirror to pick mirrors that are updated to and
#geographically close to the client.  You should use this for CentOS updates
#unless you are manually picking other mirrors.
#If the mirrorlist= does not work for you, as a fall back you can try the
#remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
 
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

CentOS 7:
/etc/yum.repos.d/CentOS-Base.repo 文件:

# CentOS-Base.repo
#The mirror system uses the connecting IP address of the client and the
#update status of each mirror to pick mirrors that are updated to and
#geographically close to the client.  You should use this for CentOS updates
#unless you are manually picking other mirrors.
#If the mirrorlist= does not work for you, as a fall back you can try the
#remarked out baseurl= line instead.

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7	

CentOS 8:

/etc/yum.repos.d/CentOS-Linux-BaseOS.repo 文件:

#CentOS-Linux-BaseOS.repo
#
#The mirrorlist system uses the connecting IP address of the client and the
#update status of each mirror to pick current mirrors that are geographically
#close to the client.  You should use this for CentOS updates unless you are
#manually picking other mirrors.
#
#If the mirrorlist does not work for you, you can try the commented out
#baseurl line instead.

[baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

/etc/yum.repos.d/CentOS-Linux-Extras.repo 文件:

#CentOS-Linux-Extras.repo
#
#The mirrorlist system uses the connecting IP address of the client and the
#update status of each mirror to pick current mirrors that are geographically
#close to the client.  You should use this for CentOS updates unless you are
#manually picking other mirrors.
#
#If the mirrorlist does not work for you, you can try the commented out
#baseurl line instead.

[extras]
name=CentOS Linux $releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

/etc/yum.repos.d/CentOS-Linux-AppStream.repo 文件:

#CentOS-Linux-AppStream.repo
#
#The mirrorlist system uses the connecting IP address of the client and the
#update status of each mirror to pick current mirrors that are geographically
#close to the client.  You should use this for CentOS updates unless you are
#manually picking other mirrors.
#
#If the mirrorlist does not work for you, you can try the commented out
#baseurl line instead.

[appstream]
name=CentOS Linux $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

/etc/yum.repos.d/CentOS-Linux-PowerTools.repo 文件:

#CentOS-Linux-PowerTools.repo
#
#The mirrorlist system uses the connecting IP address of the client and the
#update status of each mirror to pick current mirrors that are geographically
#close to the client.  You should use this for CentOS updates unless you are
#manually picking other mirrors.
#
#If the mirrorlist does not work for you, you can try the commented out
#baseurl line instead.

[powertools]
name=CentOS Linux $releasever - PowerTools
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

/etc/yum.repos.d/CentOS-Linux-Plus.repo 文件:

#CentOS-Linux-Plus.repo
#
#The mirrorlist system uses the connecting IP address of the client and the
#update status of each mirror to pick current mirrors that are geographically
#close to the client.  You should use this for CentOS updates unless you are
#manually picking other mirrors.
#
#If the mirrorlist does not work for you, you can try the commented out
#baseurl line instead.

[plus]
name=CentOS Linux $releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

(修改完成后运行 yum makecache)

Tips:
CentOS 源使用帮助:https://mirrors.ustc.edu.cn/help/centos.html
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值