一、?参考链接
阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)
epel镜像-epel下载地址-epel安装教程-阿里巴巴开源镜像站 (aliyun.com)
二、?Epel 镜像简介
EPEL (Extra Packages for Enterprise Linux), 是由 Fedora Special Interest Group 维护的 Enterprise Linux(RHEL、CentOS)中经常用到的包。
三、? 配置方法
1、更新YUM源?
[root@centos ~]# yum clean all[root@centos ~]# yum repolist
2、 备份(如有配置原来的epel源)?
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backupmv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
3、下载新repo 到/etc/yum.repos.d/?
1)安装 epel 配置包?
安装对应的安装包(本实验以CentOS 7系统为例)
[root@centos ~]# hostnamectl Static hostname: centos Icon name: computer-vm Chassis: vm Machine ID: f6fc8fb7991c4c518238af7c75f16046 Boot ID: 543d1319d8164d8dac9e789e553f3ae5 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-1160.el7.x86_64 Architecture: x86-64[root@centos ~]#[root@centos ~]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpmLoaded plugins: fastestmirrorepel-release-latest-7.noarch.rpm | 15 kB 00:00:00 Examining /var/tmp/yum-root-_WgcRs/epel-release-latest-7.noarch.rpm: epel-release-7-14.noarchMarking /var/tmp/yum-root-_WgcRs/epel-release-latest-7.noarch.rpm to be installedResolving Dependencies--> Running transaction check---> Package epel-release.noarch 0:7-14 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================== Package Arch Version Repository Size========================================================================================================================Installing: epel-release noarch 7-14 /epel-release-latest-7.noarch 25 kTransaction Summary========================================================================================================================Install 1 PackageTotal size: 25 kInstalled size: 25 kDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : epel-release-7-14.noarch 1/1 Verifying : epel-release-7-14.noarch 1/1 Installed: epel-release.noarch 0:7-14 Complete![root@centos ~]#[root@centos ~]# cd /etc/yum.repos.d/[root@centos yum.repos.d]# lltotal 60-rw-r--r--. 1 root root 2523 Nov 28 18:12 CentOS-Base.repo-rw-r--r--. 1 root root 1664 Oct 23 2020 CentOS-Base.repo.backup-rw-r--r--. 1 root root 1309 Oct 23 2020 CentOS-CR.repo-rw-r--r--. 1 root root 649 Oct 23 2020 CentOS-Debuginfo.repo-rw-r--r--. 1 root root 314 Oct 23 2020 CentOS-fasttrack.repo-rw-r--r--. 1 root root 630 Oct 23 2020 CentOS-Media.repo-rw-r--r--. 1 root root 1331 Oct 23 2020 CentOS-Sources.repo-rw-r--r--. 1 root root 8515 Oct 23 2020 CentOS-Vault.repo-rw-r--r--. 1 root root 616 Oct 23 2020 CentOS-x86_64-kernel.repo-rw-r--r-- 1 root root 2081 Dec 3 09:23 docker-ce.repo-rw-r--r-- 1 root root 1358 Sep 5 01:37 epel.repo-rw-r--r-- 1 root root 1457 Sep 5 01:37 epel-testing.repo-rw-r--r-- 1 root root 276 Dec 8 13:15 kubernetes.repo
2)将 repo 配置中的地址替换为阿里云镜像站地址?
sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
[root@centos yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*[root@centos yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
4、更新YUM源?
[root@centos yum.repos.d]# yum clean allLoaded plugins: fastestmirrorCleaning repos: base epel extras updatesCleaning up list of fastest mirrors[root@centos yum.repos.d]# yum repolistLoaded plugins: fastestmirrorDetermining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.combase | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/7): base/7/x86_64/group_gz | 153 kB 00:00:00 (2/7): epel/x86_64/group_gz | 96 kB 00:00:00 (3/7): extras/7/x86_64/primary_db | 243 kB 00:00:02 (4/7): epel/x86_64/updateinfo | 1.0 MB 00:00:03 (5/7): base/7/x86_64/primary_db | 6.1 MB 00:00:06 (6/7): epel/x86_64/primary_db | 7.0 MB 00:00:06 (7/7): updates/7/x86_64/primary_db | 13 MB 00:00:07 repo id repo name statusbase/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,691extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 500updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 3,190repolist: 27,453[root@centos yum.repos.d]#