centos6.8 解决Error: Cannot retrieve repository metadata (repomd.xml)

自己搞了一个centos6,但是yum源一直出问题,这里去找了很多方法都一直不能解决,然后便想着自己分析报错算了,结果还是自己分析明白了。。


首先这里我使用的是阿里云的源,这里很多人都是使用wget -o直接将源替换了,但是就没有注意这个替换的源有问题吗,这里我们看看。

repo安装包下载_开源镜像站-阿里云

这里这些东西是变量呀,都没有解析的,机子怎么解析网站访问都是404错误,东西怎么下载,怎么更新,真的是。

但是我们尝试将他们全部替换成6,但是之后还是失败了,这里去看看什么原因。

centos-6安装包下载_开源镜像站-阿里云

这里6的镜像站都是空的。。。。。。makecache拿什么下载东西,果然。

这里我们看到7的镜像站都是有东西的,这里我们就使用7的镜像站了,别问那里有东西就用那里了,至于版本能用就可以了。


完整步骤如下

cd /etc/yum.repos.d/

#这里我们将原本的备份了
mv CentOS-Base.repo CentOS-Base.repo.bak

vim CentOS-Base.repo


#下面的复制好了,保存好了,在执行这一句话
yum clean all && yum makecache

然后将下面我搞好的复制进去就可以了,不能复制的,建议先装一下VMware tools

# 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-7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
        http://mirrors.aliyuncs.com/centos/7/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

猜你喜欢

转载自blog.csdn.net/m0_64815693/article/details/129395727