This system is not registered with RHN替换RHEL的yum源,解决yum注册问题(小白练习)

这篇博客主要是为了锻炼自己写博客的能力,也希望能帮助一些急于处理这种问题的人,因为我写的内容很浅显,但是可以解决问题。

1.卸载rhel的yum相关的包

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

2.安装centos的源

wget   http://mirrors.163.com/.help/CentOS5-Base-163.repo

# RHEL5适用

wget   http://mirrors.163.com/.help/CentOS6-Base-163.repo
# RHEL6适用
下载先来的文件会在你当前所在的目录下,可用pwd查看当前所在路径位置,或者下载后使用
find  /  -name CentOS*
查找现在文件的位置
将下载的repo文件复制到/etc/yum.repo.d/,并重名为CentOS-Base.repo。
打开CentOS-Base.repo, 将$releaserver 为5(针对RHEL 5系列)或6(针对RHEL 6系列)

vim CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
baseurl= http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl= http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl= http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
替换后

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6 - Base - 163.com
baseurl= http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist= http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl= http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist= http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl= http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist= http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

3.下载相关RPM包

链接: https://pan.baidu.com/s/1i68zsnN  
密码:liei
是我自己的网盘文件,现在后放入Linux 自己指定的文件中,进行安装
安装顺序如下
#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-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
最后两个rpm包要同时安装,因为存在依赖关系

4.获取yum列表

最后
yum makecache

大功告成了!!!

你可能感兴趣的:(Linux,REDHAT,yum)