1. wget ://dl.fedoraproject.org/pub/epel//7/x86_64/epel-release-7-1.noarch.rpm

  2. yum install epel-release-7-1.noarch.rpm

    或者用 rpm -ivh epel-release-7-1.noarch.rpm 安装

  3. 查看是否安装成功:

    yum repolist

  4. redhat配置centos源

    vi /etc/yum.repos.d/CentOS-Base.repo

    [base]
    name=CentOS-5-Base
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
    #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
    baseurl=http://ftp.sjtu.edu.cn/centos/7/os/$basearch/
    gpgcheck=0
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
    #released updates

    [updates]
    name=CentOS-$releasever – Updates
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    baseurl=http://ftp.sjtu.edu.cn/centos/7/updates/$basearch/
    gpgcheck=0
    gpgkey=

    [extras]
    name=CentOS-$releasever – Extras
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    baseurl=http://ftp.sjtu.edu.cn/centos/7/extras/$basearch/
    gpgcheck=0
    gpgkey=

    b[centosplus]
    name=CentOS-$releasever – Plus
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    baseurl=http://ftp.sjtu.edu.cn/centos/7/centosplus/$basearch/
    gpgcheck=0
    enabled=0
    gpgkey=

  5. rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

  6. rpm -qa gpg-pubkey