由于没有购买RedHat的服务,所以RHEL7.3在yum更新的时候由于没有更新源造成更新失败,于是把RedHat的更新源设置成阿里的更新源。
wget -O /etc/yum
.repos.d/CentOS-Base
.repo http://mirrors
.aliyun.com/repo/Centos-
7.repo
运行完成后,目录下面
cat 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
.aliyun.com
failovermethod=priority
baseurl= http://mirrors
.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors
.aliyuncs.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=
1
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors
.aliyun.com
failovermethod=priority
baseurl= http://mirrors
.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors
.aliyuncs.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=
1
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors
.aliyun.com
failovermethod=priority
baseurl=http://mirrors
.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors
.aliyuncs.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=
1
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors
.aliyun.com
failovermethod=priority
baseurl=http://mirrors
.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors
.aliyuncs.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=
1
enabled=
0
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors
.aliyun.com
failovermethod=priority
baseurl=http://mirrors
.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors
.aliyuncs.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=
1
enabled=
0
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
更新的时候出现http://mirrors.aliyun.com/centos/7Server/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
这样的错误提示,http://mirrors.aliyun.com/centos/7Server/extras/x86_64/repodata/repomd.xml 这个地址无法正常访问,将上面的文件中的$releasever改成7,改后的文件如:
cat 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
.aliyun.com
failovermethod=priority
baseurl= http://mirrors
.aliyun.com/centos/
7/os/$basearch/
http://mirrors
.aliyuncs.com/centos/
7/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=
1
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors
.aliyun.com
failovermethod=priority
baseurl= http://mirrors
.aliyun.com/centos/
7/updates/$basearch/
http://mirrors
.aliyuncs.com/centos/
7/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=
1
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors
.aliyun.com
failovermethod=priority
baseurl=http://mirrors
.aliyun.com/centos/
7/extras/$basearch/
http://mirrors
.aliyuncs.com/centos/
7/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=
1
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors
.aliyun.com
failovermethod=priority
baseurl=http://mirrors
.aliyun.com/centos/
7/centosplus/$basearch/
http://mirrors
.aliyuncs.com/centos/
7/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=
1
enabled=
0
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors
.aliyun.com
failovermethod=priority
baseurl=http://mirrors
.aliyun.com/centos/
7/contrib/$basearch/
http://mirrors
.aliyuncs.com/centos/
7/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=
1
enabled=
0
gpgkey=http://mirrors
.aliyun.com/centos/RPM-GPG-KEY-CentOS-
7
现在就可以进行更新操作了。
运行 yum clean all 清除原有缓存
运行 yum makecache 获取yum列表
参考:http://mirrors.aliyun.com/help/centos