把原来的yum源卸载掉
# rpm -qa | grep yum | xargs rpm -e –-nodeps
添加并安装下载的yum的rpm包
wget http://mirrors.163.com/centos/6.8/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
# rpm -Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm
# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
[注]:最后这两个包必须同时安装,因两个是相互依赖关系。
添加163的yum源
# cd/etc/yum.repos.d/
# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
修改CentOS6-Base-163.repo
#CentOS-Base.repo
#
# The mirrorsystem uses the connecting IP address of the client and the
# update statusof each mirror to pick mirrors that are updated to and
# geographicallyclose to the client. You should use thisfor CentOS updates
# unless you aremanually picking other mirrors.
#
# If the mirrorlist=does not work for you, as a fall back you can try the
# remarked outbaseurl= line instead.
#
#
[base]
name=CentOS-6 - Base- 163.com
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
#releasedupdates
[updates]
name=CentOS-6 -Updates - 163.com
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
#additionalpackages that may be useful
[extras]
name=CentOS-6 -Extras - 163.com
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
#additionalpackages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus- 163.com
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-6 -Contrib - 163.com
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
~
~
~
~
~
~
~
~
~
~
~
# yum clean all //清理yum缓存
# yum makecache //将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
# yum install vim* //测试yum是否可用