#导入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
编辑 /etc/yum.repos.d/elrepo.repo 文件,在 mirrorlist=
开头的行前面加 #
注释掉;并将 elrepo.org/linux
替换为 mirrors.tuna.tsinghua.edu.cn/elrepo
最后,更新软件包缓存
yum makecache
EPEL(Extra Packages for Enterprise Linux)是由Fedora Special Interest Group维护的Enterprise Linux(RHEL、CentOS)中经 常用到的包。
touch /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
保存,退出。
最后,yum makecache