第一步:卸载原yum源
rpm -aq | grep yum|xargs rpm -e --nodeps
第二步:下载安装包
主要是四个包:centos包、Metadata包、fastestmirror包、python包
地址会有所变更,请去http://mirrors.163.com/centos/6/os/i386/Packages/自行寻找
wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-Metadata-parser-1.1.2-16.el6.i686.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-81.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/i386/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
第三步:安装上述包
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm rpm -ivh yum-Metadata-parser-1.1.2-16.el6.i686.rpm rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm python-urlgrabber-3.9.1-11.el6.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
最后三个包需要一起安装,因为有依赖性。
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
编辑源文件 vi /etc/yum.repos.d/CentOS-Base-163.repo
将文件中的$releasever和$basearch进行更改,前者改为6,后者改为i386(32为系统)或者x86_64(64位系统),编辑完成后保存
第五步:更新并运行
yum clean all 清除原有缓存
yum makecache 获取yum列表
原文链接:http://blog.csdn.net/qq_20278449/article/details/49512273
备注:如果安装文件时遇到conflicts with file from(文件冲突报错),则在rpm的最后加上“--force”进行强制安装即可。
原文链接:https://www.f2er.com/bash/391552.html