文章目录
 - 配置 yum 源
 - 配置网络 yum 源
 - 备份
 - 下载阿里 centos-base.repo 到 /etc/yum.repos.d/
 - 安装 EPEL 源
 - 测试安装
 
 
 
 
  
 
配置 yum 源
 
rpm -qa|grep yum
yum list installed
rpm -qa|grep xxx
ntpdate-4.2.6p5-29.el7.centos.2.x86_64
rpm -ql ntpdate-4.2.6p5-29.el7.centos.2.x86_64
/etc/ntp
/etc/ntp/keys
/etc/ntp/step-tickers
/etc/sysconfig/ntpdate
/usr/lib/systemd/system/ntpdate.service
/usr/libexec/ntpdate-wrapper
/usr/sbin/ntpdate
/usr/share/doc/ntpdate-4.2.6p5
/usr/share/doc/ntpdate-4.2.6p5/COPYRIGHT
/usr/share/man/man8/ntpdate.8.gz
 
配置网络 yum 源
 
备份
 
cd /etc/yum.repos.d
ll
总用量 40
-rw-r--r--. 1 root root 1664 10月 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 10月 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root  649 10月 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 10月 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 10月 23 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 10月 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 10月 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root  616 10月 23 2020 CentOS-x86_64-kernel.repo
mkdir repo_back
mv *.repo repo_back/
mv *.repo.bak repo_back/
ll
 
下载阿里 centos-base.repo 到 /etc/yum.repos.d/
 
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repoll
总用量 4
-rw-r--r--. 1 root root 2523 11月  7 11:25 CentOS-Base.repo
drwxr-xr-x. 2 root root  220 11月  7 11:21 repo_back
yum clean all
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors
yum makecache
已加载插件:fastestmirror
Determining fastest mirrors* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.comhttp://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl
正在尝试其它镜像。
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl
正在尝试其它镜像。
base                                                                          | 3.6 kB  00:00:00     
extras                                                                        | 2.9 kB  00:00:00     
updates                                                                       | 2.9 kB  00:00:00     
(1/10): base/7/x86_64/group_gz                                                | 153 kB  00:00:00     
(2/10): base/7/x86_64/primary_db                                              | 6.1 MB  00:00:08     
(3/10): extras/7/x86_64/filelists_db                                          | 303 kB  00:00:03     
(4/10): extras/7/x86_64/primary_db                                            | 250 kB  00:00:03     
(5/10): extras/7/x86_64/other_db                                              | 150 kB  00:00:00     
(6/10): base/7/x86_64/other_db                                                | 2.6 MB  00:00:07     
(7/10): base/7/x86_64/filelists_db                                            | 7.2 MB  00:00:17     
(8/10): updates/7/x86_64/filelists_ 58% [===============           ] 1.2 MB/s |  32 MB  00:00:18 ETA 
(8/10): updates/7/x86_64/filelists_db                                         |  13 MB  00:00:23     
(9/10): updates/7/x86_64/other_db                                             | 1.4 MB  00:00:02     
(10/10): updates/7/x86_64/primary_db                                          |  24 MB  00:00:33     
元数据缓存已建立
 
安装 EPEL 源
 
yum list | grep epel-release
epel-release.noarch                         7-11                       extras   yum install -y epel-release
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成依赖关系解决===================================================================================================== Package                     架构                  版本                  源                     大小
=====================================================================================================正在安装:epel-release                noarch                7-11                  extras                 15 k事务概要
=====================================================================================================安装  1 软件包总下载量:15 k
安装大小:24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                                  |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装    : epel-release-7-11.noarch                                                         1/1 验证中      : epel-release-7-11.noarch                                                         1/1 已安装:epel-release.noarch 0:7-11                                                                         完毕!
ll
yum clean all
已加载插件:fastestmirror
正在清理软件源: base epel extras updates
Cleaning up list of fastest mirrors
yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                          | 7.6 kB  00:00:00     * base: mirrors.aliyun.com* epel: mirrors.bfsu.edu.cn* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
base                                                                          | 3.6 kB  00:00:00     
https://mirror.01link.hk/epel/7/x86_64/repodata/repomd.xml: [Errno 14] curl
正在尝试其它镜像。
It was impossible to connect to the CentOS servers.
This could mean a connectivity issue in your environment, such as the requirement to configure a proxy,
or a transparent proxy that tampers with TLS security, or an incorrect system clock.
You can try to solve this issue by using the instructions on https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.epel                                                                          | 4.7 kB  00:00:00     
extras                                                                        | 2.9 kB  00:00:00     
updates                                                                       | 2.9 kB  00:00:00     
(1/16): base/7/x86_64/group_gz                                                | 153 kB  00:00:00     
(2/16): base/7/x86_64/primary_db                                              | 6.1 MB  00:00:05     
(3/16): epel/x86_64/group_gz                                                  |  99 kB  00:00:00     
(4/16): epel/x86_64/prestodelta                                               | 2.9 kB  00:00:00     
(5/16): epel/x86_64/primary_db                                                | 7.0 MB  00:00:09     
(6/16): base/7/x86_64/other_db                                                | 2.6 MB  00:00:09     
(7/16): extras/7/x86_64/filelists_db                                          | 303 kB  00:00:00     
(8/16): extras/7/x86_64/primary_db                                            | 250 kB  00:00:00     
(9/16): extras/7/x86_64/other_db                                              | 150 kB  00:00:00     
(10/16): epel/x86_64/updateinfo                                               | 1.0 MB  00:00:17     
(11/16): updates/7/x86_64/filelists_db                                        |  13 MB  00:00:18     
(12/16): updates/7/x86_64/other_db                                            | 1.4 MB  00:00:03     
(13/16): base/7/x86_64/filelists_db 68% [=================-        ] 1.2 MB/s |  53 MB  00:00:19 ETA 
(13/16): epel/x86_64/other_db                                                 | 3.4 MB  00:00:36     
(14/16): updates/7/x86_64/primary_db                                          |  24 MB  00:00:36     
(15/16): epel/x86_64/filelists_db                                             |  12 MB  00:01:00     
(16/16): base/7/x86_64/filelists_db                                           | 7.2 MB  00:02:02     元数据缓存已建立
yum repolist enabled
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* epel: mirrors.bfsu.edu.cn* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
源标识                          源名称                                                         状态
base/7/x86_64                   CentOS-7 - Base - mirrors.aliyun.com                           10,072epel/x86_64                     Extra Packages for Enterprise Linux 7 - x86_64                 13,791extras/7/x86_64                 CentOS-7 - Extras - mirrors.aliyun.com                            518updates/7/x86_64                CentOS-7 - Updates - mirrors.aliyun.com                         5,367repolist: 29,748
yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* epel: mirrors.bfsu.edu.cn* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
源标识                        源名称                                                     状态
base/7/x86_64                 CentOS-7 - Base - mirrors.aliyun.com                       启用: 10,072centosplus/7/x86_64           CentOS-7 - Plus - mirrors.aliyun.com                       禁用
contrib/7/x86_64              CentOS-7 - Contrib - mirrors.aliyun.com                    禁用
epel/x86_64                   Extra Packages for Enterprise Linux 7 - x86_64             启用: 13,791epel-debuginfo/x86_64         Extra Packages for Enterprise Linux 7 - x86_64 - Debug     禁用
epel-source/x86_64            Extra Packages for Enterprise Linux 7 - x86_64 - Source    禁用
epel-testing/x86_64           Extra Packages for Enterprise Linux 7 - Testing - x86_64   禁用
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - 禁用
epel-testing-source/x86_64    Extra Packages for Enterprise Linux 7 - Testing - x86_64 - 禁用
extras/7/x86_64               CentOS-7 - Extras - mirrors.aliyun.com                     启用:    518updates/7/x86_64              CentOS-7 - Updates - mirrors.aliyun.com                    启用:  5,367repolist: 29,748
 
测试安装
 
yum install -y httpd
yum erase httpd -y