给RedHat机器配置CentOS的Repository
来源:互联网 发布:外网监控软件 编辑:程序博客网 时间:2024/05/24 06:53
前言:
当我们安装了RedHat 的机器时,如果不到RedHat网站注册,会导致不能安装其网站上所 host的软件。而CentOS作为Redhat的社区版,与对应版本的RedHat完全兼容(其发行的Binary就是从RedHat编译而来),因此我们可以考虑将RedHat机器的Repository替换为CentOS的Repository
现象: 当用 yum install $softwarePackage时,报如下错误:
This system is not registered with RHN.
RHN support will be disabled.
1.1 编辑 rhnplugin.conf ( vi /etc/yum/pluginconf.d/rhnplugin.conf ) ,使它具有如下内容:
[main]enabled = 0gpgcheck = 0[rhel-i386-server-5]enabled = 0#[some-unsigned-custom-channel]#gpgcheck = 0
1.2 创建/编辑 centOS的repo
解决方案1-使用heanet:
编辑centos.repo [位于/etc/yum.repos.d] (vi /etc/yum.repos.d/centos.repo),使它具有以下内容(根据你的版本将 6 保持或改为5 ):
[centos]name=CentOS $releasever - $basearchbaseurl=http://ftp.heanet.ie/pub/centos/6/os/$basearch/enabled=1gpgcheck=0
解决方案2:
1. 假设你的Redhat版本是6. 将以下文件内容创建为 CentOS-Base.repo 并置于/etc/yum.repos.d 目录下:
# 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 - Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-$releasever - Updatesmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
如果装软件时 (yum install)遇到以下错误:
YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. 6Server is not a valid release or hasnt been released yet
请将CentOS-Base.repo文件中的$releasever 替换为6 (vi中用 :%s/$releasever/6/g),然后执行yum update
2. 假设你的Redhat版本是7. 将以下文件内容创建为 CentOS-Base.repo 并置于/etc/yum.repos.d 目录下:
# 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-7 - Basemirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/7/os/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7#released updates [updates]name=CentOS-7 - Updatesmirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates#baseurl=http://mirror.centos.org/centos/7/updates/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-7 - Extrasmirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras#baseurl=http://mirror.centos.org/centos/7/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-7 - Plusmirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus#baseurl=http://mirror.centos.org/centos/7/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7#contrib - packages by Centos Users[contrib]name=CentOS-7 - Contribmirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=contrib#baseurl=http://mirror.centos.org/centos/7/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7然后执行yum update
- 给RedHat机器配置CentOS的Repository
- 给自己的机器配置一个统一的代理出口
- 我的新机器配置
- 深度学习的机器配置
- 机器配置
- Redhat http repository
- CentOS与RedHat的关系
- CentOS与RedHat的关系
- centos和redhat的区别
- redhat使用centos的yum
- CentOS与RedHat的关系
- 查看机器配置的命令:)
- redhat 6设置CentOS的yum源
- redhat 6设置CentOS的yum源
- RedHat CentOS 添加新硬件的方法
- Redhat Enterprise Linux与CentOS的区别
- redhat 6设置CentOS的yum源
- centos和redhat的iftop安装
- 如何保存指针地址 理解指针的指针
- jquery mobile popup的afterclose事件不触发的问题
- CountDownLatch的使用
- Eclipse快捷键大全
- 【转载】用CSS将登录框水平垂直居中于浏览器
- 给RedHat机器配置CentOS的Repository
- JS基础——属性操作
- unix i/o create函数解惑
- C修改文件内容
- java 基于linkedhashmap实现LRUCache
- 大奖赛积分
- 架设Hmailserver+webmail邮件服务器
- Android 休眠 FLAG_KEEP_SCREEN_ON
- Quick-Cocos2d-x-3.2中示例Coinfilp总结(二)