卸载自带的yum软件包
rpm -e yum-utils-1.1.-.el7.noarch --nodeps
rpm -e yum-rhn-plugin-2.0.-.el7.noarch --nodeps
rpm -e yum-metadata-parser-1.1.-.el7.x86_64 --nodeps
rpm -e yum-langpacks-0.4.-.el7.noarch --nodeps
rpm -e PackageKit-yum-0.8.-.el7.x86_64 --nodeps
下载Centos的rpm安装包
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-34.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
如果再在不来:http://pan.baidu.com/s/1dFdqL6h
安装下载的软件包
rpm -ivh yum-*
新建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-$ - Base - .com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-$ - Updates - .com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-$ - Extras - .com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$ - Plus - .com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=
enabled=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
清除缓存
yum clean all
至此完成安装