您的位置:首页 > 其它

关于redhat 6.5 yum源配置问题的解决方法

2015-04-13 14:28 387 查看
redhat6.5在安装好命令界面后执行yum list或yum update命令提示:This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 主要是未订阅注册redhat。导致yum源不可使用。解决方法可以将现有系统上的yum软件卸载之后,安装上CentOS6.5的yum软件,然后更改/etc/yum.repos.d/目录下的CentOS配置文件,将yum源更改为163的源,这样就可以正常使用redhat6.5的yum命令了。

安装好redhat6.5后,执行yum list会跳出未注册信息。这时我们用

rpm -qa | grep yum


命令查看已安装的yum相关软件。此时会显示已安装的yum相关软件有4款。

接着执行

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


将这四款软件卸载

接着将CentOS中的三款yum软件用winSCP火FTP工具上传到linux系统某一文件夹下,记住,要在root权限下。

yum-3.2.29-40.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.i686.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

下载地址:CentOS6.5 yum安装包

winSCP或FTP传输工具网站上可以随意下载,这里就不多赘述。

接着在当前文件夹下执行:

rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm


(如果这行命令执行失败,可能是之前的卸载命令没有执行成功,重新执行一次就可以)

安装成功后进入/etc/yum.repos.d/目录下(最好将已经存在的文件mv成.bak文件,如果不执行此操作也不会有问题)

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


将CentOS6-Base-163.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-6.5 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.5 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&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.5 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.5 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.5 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


最后执行 yum update即可。

这时候再试试 yum list是不是可以正常显示了~!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息