RedHat 6.6 替换yum源为CentOS源

  • 删除原来的 yum
rpm -qa |grep yum
rpm -qa|grep yum|xargs rpm -e --nodeps
  • 查看系统版本
cat /etc/redhat-release
uname -m
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
  • 开始安装
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm

因为缺少python-urlgrabber组件 安装失败
先卸载原来的python,安装新的python

rpm -qa python
rpm -e python-2.6.6-52.el6.x86_64 --nodeps
wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/security/python-2.6.6-64.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm
rpm -ivh python-libs-2.6.6-66.el6_8.x86_64.rpm python-2.6.6-64.el6.x86_64.rpm --nodeps --force (这两个组件需要一起安装 不然会报错)

继续安装

rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm --nodeps --force
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
#查询当前subscription-manager 并且卸载
rpm -qa | grep subsc*
rpm -e subscription-manager-1.12.14-7.el6.x86_64
  • 设置yum

下载repo文件 到 /etc/yum.repos.d/

cd /etc/yum.repos.d/
wget  http://mirrors.163.com/.help/CentOS7-Base-163.repo
将下载下来的文件里的$releasever全部替换成版本号 6
yum clean all
yum makecache
yum update

相关推荐