解决方法1:
使用 vi /etc/yum.repos.d/CentOS-Base.repo 命令编辑yum 配置文件。
然后将里面的默认内容全部删除,再替换成以下内容:
[base]
name=CentOS-$releasever - Base
failovermethod=priority
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
# released updates
[updates]
name=CentOS-$releasever - Updates
failovermethod=priority
baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
# additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
保存退出,重启服务器即可
解决方法2:
如果使用的是 epel源,
就用命令 vi /etc/yum.repos.d/epel.repo ,编辑epel源文件,删除全部默认内容,再替换为以下内容:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
然后保存退出,执行下面这三条命令
yum clean all
yum makecache
yum update
转载自
链接: link.