Linux基础:更换CentOS的YUM源

这篇文章以网易云的CentOS的YUM源为例介绍一下如何进行更换。

步骤1: 下载网易云CentOS的YUM源

执行命令(网易云源):wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

执行命令(阿里云源):wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@liumiaocn ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2020-08-22 10:50:41--  http://mirrors.163.com/.help/CentOS7-Base-163.repo
Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251
Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1572 (1.5K) [application/octet-stream]
Saving to: '/etc/yum.repos.d/CentOS-Base.repo'

100%[==============================================================================================>] 1,572       --.-K/s   in 0s      

2020-08-22 10:50:41 (127 MB/s) - '/etc/yum.repos.d/CentOS-Base.repo' saved [1572/1572]

[root@liumiaocn ~]#

步骤2: yum clean all

[root@liumiaocn ~]# yum clean all
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
[root@liumiaocn ~]# 

步骤3: yum makecache

[root@liumiaocn ~]# yum makecache
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Determining fastest mirrors
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:00     
(3/10): base/7/x86_64/other_db                                                                                   | 2.6 MB  00:00:00     
(4/10): extras/7/x86_64/filelists_db                                                                             | 217 kB  00:00:00     
(5/10): extras/7/x86_64/primary_db                                                                               | 206 kB  00:00:00     
(6/10): extras/7/x86_64/other_db                                                                                 | 124 kB  00:00:00     
(7/10): updates/7/x86_64/primary_db                                                                              | 3.8 MB  00:00:01     
(8/10): updates/7/x86_64/other_db                                                                                | 314 kB  00:00:00     
(9/10): updates/7/x86_64/filelists_db                                                                            | 2.1 MB  00:00:01     
(10/10): base/7/x86_64/filelists_db                                                                              | 7.1 MB  00:00:06     
Metadata Cache Created
[root@liumiaocn ~]# 

再次试验就会发现yum install会快一些了。

你可能感兴趣的:(#,Linux基础,YUM,CentOS,Linux,网易云,阿里云)