Redhat源是要收费的,机器已经上架无法安装软件和更新,CentOS出自Redhat可以使用CentOS源。
删除旧的yum
rpm -aq | grep yum|xargs rpm -e --nodeps
获取和安装CentOS的yum相关包
# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm # wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm # wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-60.el6.centos.noarch.rpm # wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
安装CentOS的yum
# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm # rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm # rpm -ivh yum-3.2.29-60.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
更改合适的yum源
可以使用网易的CentOS镜像
# cd /etc/yum.repos.d/ # wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
编辑文件,把文件里面的$releasever全部替换为版本号,即6;
# vi CentOS6-Base-163.repo :%s/\$releasever/6/g
使用新的yum
# yum clean all # yum makecache # yum update