redhat6.5替换为centos6网易yum源


原因:RHEL的YUM源需要注册用户才能更新使用,由于CentOS和RHEL基本没有区别,并且CentOS已经被REHL收购。所以将RHEL的YUM源替换为CentOS即可。

1. 清除redhat原有yum相关软件包

2. 下载centos6的相关软件包

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-utils-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

3. 安装步骤2下载的软件包

rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm

【注意】yum-plugin-fastestmirror和yum-3.2.29要一起安装

报错如下:

解决如下:

重新下载3.9.1-11版本并安装:

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

继续yum包的安装

rpm -ivh yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm
rpm -ivh yum-utils-1.1.30-41.el6.noarch.rpm

4. 更改yum源

cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo  //下载配置文件
sed -i "s;\$releasever;6;g" CentOS6-Base-163.repo   //将配置文件中所有$releasever替换为6
mv rhel-source.repo rhel-source.repo.bak   //更改原配置文件名称

5. 更新yum

yum clean all   //清理yum缓存
yum makecache    //将服务器软件包信息缓存至本地,提高搜索安装效率

6. 使用yum安装软件

yum -y install 软件名

参考https://blog.csdn.net/kimyoungvon/article/details/53103300