为CentOS 6.x添加EPEL源

来源:互联网 发布:刚哥哥淘宝店招制作 编辑:程序博客网 时间:2024/05/01 20:57
  要了解EPEL,可以阅读网页 http://fedoraproject.org/wiki/EPEL/zh-cn 上的介绍。EPEL源上提供的软件包适用于RedHat EL及其衍生发行版,包括CentOS、Scientific Linux、Oracle Linux。
  最近安装了CentOS 6.5 64-bit Destop版,感觉使用自带的yum安装软件时访问速度比较慢,就动手为它添加EPEL源,做法适用于CentOS 6.x所有版本,过程如下:

1.执行命令
  rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6

2.如果是32位操作系统,执行命令
   wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
  如果是64位操作系统,不是用作服务器(安装CentOS操作系统时可以选择用途,分为Destop、Minimal、Server等),执行命令
   wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  如果是64位操作系统,用作服务器,执行命令
   wget http://dl.fedoraproject.org/pub/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
3.执行命令
   rpm -ivh epel-release-6-8.noarch.rpm
4.用文本编辑器打开/etc/yum.repos.d目录下的epel.repo文件,
    如果是32位操作系统,将epel.repo文件中所有的$basearch替换为i386;
    如果是64位操作系统(非服务器),将epel.repo文件中所有的$basearch替换为x86_64。
   注意:这一步不做也可以。
5.清理并重建缓存中的内容,执行命令
   yum clean all
   yum makecache

  最后执行命令
    yum repolist
  结果如下:
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.yun-idc.com
 * updates: mirrors.yun-idc.com
repo id          repo name                                                status
base             CentOS-6 - Base                                           6,367
epel             Extra Packages for Enterprise Linux 6 - x86_64           10,694
extras           CentOS-6 - Extras                                            14
updates          CentOS-6 - Updates                                          775
repolist: 17,850
  可以看到已经添加了epel源,镜像站点中包含国内网站mirrors.163.com和mirrors.yun-idc.com,访问国内网站的速度要比国外快。
  如果想暂时停用epel源,可以打开/etc/yum.repos.d目录下的epel.repo文件,默认情况下在[epel]段落中包含enabled=1这一行,将其改为enabled=0就可以了,取值为0表示禁用。

 

0 0
原创粉丝点击