1.前置准备工作
#导入gpg key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
#在/etc/yum.repos.d/下安装elrepo.repo 文件
yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
2.vim未安装可以先安装一下
sudo yum install vim
3.编辑 /etc/yum.repos.d/elrepo.repo 文件
vim /etc/yum.repos.d/elrepo.repo
在 mirrorlist= 开头的行前面加 # 注释掉;并将 elrepo.org/linux 替换为 mirrors.tuna.tsinghua.edu.cn/elrepo
这个链接可以打开:
清华大学开源软件镜像站
4.更新软件包缓存
yum makecache
5.新建 epel.repo 文件
touch /etc/yum.repos.d/epel.repo
vim /etc/yum.repos.d/epel.repo
编辑文件/etc/yum.repos.d/epel.repo,内容如下:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
6.最后,yum makecache
yum makecache
参考
ELRepo.org
EPEL 名词解释
EPEL(Extra Packages for Enterprise Linux)是由Fedora Special Interest Group维护的Enterprise Linux(RHEL、CentOS)中经 常用到的包。
说明
感兴趣的小伙伴也可以试一下,用阿里提供的epel
http://mirrors.aliyun.com/repo/epel-6.repo
http://mirrors.aliyun.com/repo/epel-7.repo