0%

将Centos7的yum源更换为国内阿里云的源

CentOS7默认的yum源的地址是http://mirror.centos.org,需要把其换成国内的镜像,这样访问速度会更加快一些。

  1. 备份系统默认的CentOS-Base.repo
1
$ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载阿里云的repo文件
1
2
$ cd /etc/yum.repos.d/
$ wget -c http://mirrors.aliyun.com/repo/Centos-7.repo
  1. 生成缓存
$ yum makecache

已加载插件:fastestmirror, langpacks
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30181 milliseconds')
正在尝试其它镜像。
base                                                     | 3.6 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
(1/5): extras/7/x86_64/filelists_db                        | 519 kB   00:00     
(2/5): extras/7/x86_64/other_db                            |  95 kB   00:00     
(3/5): updates/7/x86_64/filelists_db                       | 1.3 MB   00:01     
(4/5): base/7/x86_64/filelists_db                          | 6.9 MB   00:03     
(5/5): extras/7/x86_64/prestodelta                         |  48 kB   00:11     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
元数据缓存已建立