From:http://www.dedecms8.com/db/php_bc/12322.html
1、删除redhat原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps
2、下载yum(因为包不断更新,此处如果不能获取相关包,可到http://mirrors.163.com/centos/6/os/x86_64/查找下载相应文件
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
3、安装yum
rpm -ivh python-iniparse-0.3.-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.-14.1.el6.x86_64.rpm
rpm -ivh yum-3.2.-.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.-.el6.noarch.rpm
(注意:最后两个包需要一起安装,前后顺序不能调换)
4、更新repo文件
下载repo
cd /root
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
修改CentOS6-Base-163.repo,将其中的$releaserver全部替换为6.
删除已有的repo文件
cd /etc/yum.repo.d
rm -rf *
将下载的repo文件移动到/etc/yum.repo.d目录下:
cd /root
mv CentOS6-Base-.repo /etc/yum.repo.d/server.repo
5、清空缓存
yum clean all
6、生成缓存并更新源
yum makecache
yum update
7、安装软件
yum install XXX
常见错误及解决方案:
http://www.cnblogs.com/zuiyirenjian/archive/2012/07/26/2609227.html