在 RHEL 中使用 CentOS repositories

来源:互联网 发布:量化投资 python 编辑:程序博客网 时间:2024/06/08 13:12


禁用 RHEL 的每个仓库配置

修改目录 /etc/yum.repos.d  下每个文件,将 enable=1 改为 enable=0,或者也可以将这个目录清空

建立 CentOS 的配置 /etc/yum.repos.d/centos.repo ,内容为:

[CentOS5 base]name=CentOS-5-Basemirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=osgpgcheck=1enabled=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5[CentOS5 updates]name=CentOS-5-Updatesmirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updatesgpgcheck=1enabled=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5[CentOS5plus]name=CentOS-5-Plusmirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplusgpgcheck=1enabled=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

这些仓库需要 GPG 验证,还需要把公钥复制下来。 或者也可以将 centos.repo 中 gpgcheck=1 改为 gpgcheck=0 来避免验证:

rpm --import http://isoredirect.centos.org/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

测试是否可用

# yum list availableLoaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Bad id for repo: CentOS5 base, byte =   7Bad id for repo: CentOS5 updates, byte =   7

上面的仓库地址是在 这里 找到的,因为 仓库 ID 带了空格造成 错误 Bad id for repo: CentOS5 base, byte =   7,去掉空格就可以了

Bad id 说的就是 repo 文件中方括号中的 仓库 ID, byte = 7 为引起错误的地方

对于 “This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register” 问题

可在使用 yum 时禁用相应插件,如:

yum --disableplugin=subscription-manager list available

或 将 /etc/yumconf 中 plugins=1 改为 plugins=0 来禁用所有插件

也可以禁用指定插件,在 /etc/yum/pluginconf.d 下找到插件对应的文件 ,如要禁用 subscription-manager 插件,修改 /etc/yum/pluginconf.d/subscription-manager.conf 文件

将 enabled=1 改为 enabled=0 即可


如果要得到更好的支持,可以把 CentOS 的 Release Node : centos-release 和 centos-release-notes 安装上



0 0
原创粉丝点击