【阿里云镜像】配置阿里巴巴开源镜像站镜像——Epel镜像

一、参考链接

阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)

epel镜像-epel下载地址-epel安装教程-阿里巴巴开源镜像站 (aliyun.com)

阿里云开源镜像站资源目录 (aliyun.com)

二、Epel 镜像简介

EPEL (Extra Packages for Enterprise Linux), 是由 Fedora Special Interest Group 维护的 Enterprise Linux(RHEL、CentOS)中经常用到的包。

下载地址:https://mirrors.aliyun.com/epel/

三、 配置方法

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.backup
 mv /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.rpm
 Loaded plugins: fastestmirror
 epel-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.noarch
 Marking /var/tmp/yum-root-_WgcRs/epel-release-latest-7.noarch.rpm to be installed
 Resolving Dependencies
 --> Running transaction check
 ---> Package epel-release.noarch 0:7-14 will be installed
 --> Finished Dependency Resolution
 
 Dependencies Resolved
 
 ======================================================================================================================== Package                    Arch                 Version              Repository                                   Size
 ========================================================================================================================Installing:
  epel-release               noarch               7-14                 /epel-release-latest-7.noarch                25 k
 
 Transaction Summary
 ========================================================================================================================Install  1 Package
 
 Total size: 25 k
 Installed size: 25 k
 Downloading packages:
 Running transaction check
 Running transaction test
 Transaction test succeeded
 Running 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]# ll
 total 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 all
 Loaded plugins: fastestmirror
 Cleaning repos: base epel extras updates
 Cleaning up list of fastest mirrors
 [root@centos yum.repos.d]# yum repolist
 Loaded plugins: fastestmirror
 Determining fastest mirrors
  * base: mirrors.aliyun.com
  * extras: mirrors.aliyun.com
  * updates: mirrors.aliyun.com
 base                                           | 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                  status
 base/7/x86_64  CentOS-7 - Base - mirrors.aliyun.com      10,072
 epel/x86_64   Extra Packages for Enterprise Linux 7 - x86_64   13,691
 extras/7/x86_64   CentOS-7 - Extras - mirrors.aliyun.com       500
 updates/7/x86_64   CentOS-7 - Updates - mirrors.aliyun.com 3,190
 repolist: 27,453
 [root@centos yum.repos.d]#

你可能感兴趣的:(【阿里云镜像】配置阿里巴巴开源镜像站镜像——Epel镜像)