记录学习与生活的点滴…
分类: LINUX
2013-07-17 08:53:29
注册RHN服务的费用算下来一年至少也得1000多元每台,价格不菲。由于CentOS是RHEL的社区编译版本,绝大多数软件包完全相同,且提供了免费的yum源,所以我们可以使用CentOS 5的yum源来对RHEL的软件进行在线安装与更新。
配置的思路其实很简单,就是将CentOS的yum源配置文件/etc/yum.repos.d/CentOS-Base.repo中的配置信息复制过来,创建一个新的repo仓库文件,进行相应的修改即可。
下面开始配置过程:
1. 创建新的.repo仓库文件
输入以下内容(RHEL自带的.repo文件是不需要删除的,因为在检测到未注册RHN服务以后,它们根本不会被启用。)
# vim /etc/yum.repos.d/rhel-rpms-from-centos-source.repo
| 01 | [base] |
| 02 | name=Red Hat Enterprise Linux $releasever - Base |
| 03 | baseurl=$basearch/ |
| 04 | gpgcheck=1 |
| 05 | gpgkey= |
| 06 |
| 07 | #released updates |
| 08 | [updates] |
| 09 | name=Red Hat Enterprise Linux $releasever - Updates |
| 10 | baseurl=$basearch/ |
| 11 | gpgcheck=1 |
| 12 | gpgkey= |
| 13 |
| 14 | #packages used/produced in the build but not released |
| 15 | [addons] |
| 16 | name=Red Hat Enterprise Linux $releasever - Addons |
| 17 | baseurl=$basearch/ |
| 18 | pgcheck=1 |
| 19 | gpgkey= |
| 20 |
| 21 | #additional packages that may be useful |
| 22 | [extras] |
| 23 | name=Red Hat Enterprise Linux $releasever - Extras |
| 24 | baseurl=$basearch/ |
| 25 | gpgcheck=1 |
| 26 | gpgkey= |
| 27 |
| 28 | #additional packages that extend functionality of existing packages |
| 29 | [centosplus] |
| 30 | name=Red Hat Enterprise Linux $releasever - Plus |
| 31 | baseurl=$basearch/ |
| 32 | gpgcheck=1 |
| 33 | enabled=0 |
| 34 | gpgkey= |
| 35 |
| 36 | #contrib - packages by Centos Users |
| 37 | [contrib] |
| 38 | name=Red Hat Enterprise Linux $releasever - Contrib |
| 39 | baseurl=$basearch/ |
| 40 | gpgcheck=1 |
| 41 | enabled=0 |
| 42 | gpgkey= |
2.导入RPM-KEY
32位系统下执行:
#rpm --import
64位系统下执行:
#rpm --import
3.清理缓存
# yum clean all
4.完成配置,可开始使用yum
# yum install zip
================================
在国内使用CentOS的官方源会比较慢,建议采用一些国内的yum源,将mirror.centos.org更换为对应的站点域名即可。
下面是上海交大的yum源配置文件,供大家使用。
| 01 | [base] |
| 02 | name=Red Hat Enterprise Linux $releasever - Base |
| 03 | baseurl=$basearch/ |
| 04 | gpgcheck=1 |
| 05 | gpgkey= |
| 06 |
| 07 | #released updates |
| 08 | [updates] |
| 09 | name=Red Hat Enterprise Linux $releasever - Updates |
| 10 | baseurl=$basearch/ |
| 11 | gpgcheck=1 |
| 12 | gpgkey= |
| 13 |
| 14 | #packages used/produced in the build but not released |
| 15 | [addons] |
| 16 | name=Red Hat Enterprise Linux $releasever - Addons |
| 17 | baseurl=$basearch/ |
| 18 | pgcheck=1 |
| 19 | gpgkey= |
| 20 |
| 21 | #additional packages that may be useful |
| 22 | [extras] |
| 23 | name=Red Hat Enterprise Linux $releasever - Extras |
| 24 | baseurl=$basearch/ |
| 25 | gpgcheck=1 |
| 26 | gpgkey= |
| 27 |
| 28 | #additional packages that extend functionality of existing packages |
| 29 | [centosplus] |
| 30 | name=Red Hat Enterprise Linux $releasever - Plus |
| 31 | baseurl=$basearch/ |
| 32 | gpgcheck=1 |
| 33 | enabled=0 |
| 34 | gpgkey= |
| 35 |
| 36 | #contrib - packages by Centos Users |
| 37 | [contrib] |
| 38 | name=Red Hat Enterprise Linux $releasever - Contrib |
| 39 | baseurl=$basearch/ |
| 40 | gpgcheck=1 |
| 41 | enabled=0 |
| 42 | gpgkey= |
另外,在局域网环境内,推荐大家参考一下我的这一篇文章:
《利用DVD安装光盘构建属于自己的RHEL yum安装源》:转自: