首页 > 代码库 > rhel替换centos源

rhel替换centos源



参考文档:http://crushlinux.blog.51cto.com/2663646/1564136


1.卸载redhat原有的yum

rpm -qa | grep yum | xargs rpm -e --nodeps


2.下载yum包

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.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-3.2.29-73.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm


3.安装下载下来的包,注意下边的顺序

要是有安不上的话,把之前安装的都卸载了,重新安装下边的顺序安装即可

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh 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-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm



备份之前的repo文件

mkdir /tmp/bak

mv /etc/yum.repos.d/* /tmp/bak/


从163下载centos6的repo文件

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -P /etc/yum.repos.d/


编辑文件,把文件里的$releasever全部替换为版本号

vim /etc/yum.repos.d/CentOS6-Base-163.repo

:0,$s/\$releasever/6/g
:wq


=================


以下命令含义一次对应:


清理yum缓存

更新yum缓存

安装yum企业源


yum clean all

yum makecache

yum -y install epel-release



切记    不要执行    yum update








本文出自 “RSLinux” 博客,请务必保留此出处http://readshlinux.blog.51cto.com/9322509/1900555

rhel替换centos源