VMware虚拟机CentOS6.3出现yum安装出错

时间:2022-09-05 07:05:34
yum安装时出现


Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
or
14: PYCURL ERROR 6 - "Couldn't resolvehost 'mirrorlist.centos.org'"
or
[Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
or
removing mirrorlist with no valid mirrors: //var/cache/yum/fedora/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again

可能是yum源出问题,或者网连不上。

1、先试试网络能连上不,可能ping得通wget没结果

wget www.google.com
如果连不上,先检查网络

2、改yum配置,这里改为163的源

cd /etc/yum.repos.d
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@localhost yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.bak
将CentOS6-Base-163.repo的内容复制到CentOS-Base.repo

注意将里面的$releasever 换成Centos的版本6

如下:





# 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 - 163.com
#baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates - 163.com
#baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
#baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
#baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

因为太菜,更要努力学习