CentOS更换国内yum源(aliyun阿里镜像)

来源:互联网 发布:怎么查看淘宝账号等级 编辑:程序博客网 时间:2024/04/28 18:02

1、下载aliyun的repo

[root@master ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

--2016-12-30 23:33:00--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com... 112.124.140.210, 115.28.122.210
Connecting to mirrors.aliyun.com|112.124.140.210|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2573 (2.5K) [application/octet-stream]
Saving to: “/etc/yum.repos.d/CentOS-Base.repo”

100%[=======================================================================>] 2,573       --.-K/s   in 0s      

2016-12-30 23:33:00 (147 MB/s) - “/etc/yum.repos.d/CentOS-Base.repo” saved [2573/2573]

2、更新yum缓存

[root@master ~]# yum clean all

Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@master ~]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                 | 3.7 kB     00:00     
base/group_gz                                                                                                                                        | 226 kB     00:00     
base/filelists_db                                                                                                                                    | 6.4 MB     00:06     
base/primary_db                                                                                                                                      | 4.7 MB     00:04     
base/other_db                                                                                                                                        | 2.8 MB     00:02     
extras                                                                                                                                               | 3.4 kB     00:00     
extras/filelists_db                                                                                                                                  |  38 kB     00:00     
extras/prestodelta                                                                                                                                   | 1.3 kB     00:00     
extras/primary_db                                                                                                                                    |  37 kB     00:00     
extras/other_db                                                                                                                                      |  51 kB     00:00     
updates                                                                                                                                              | 3.4 kB     00:00     
updates/filelists_db                                                                                                                                 | 2.5 MB     00:02     
updates/prestodelta                                                                                                                                  | 279 kB     00:00     
updates/primary_db                                                                                                                                   | 3.7 MB     00:03     

updates/other_db                                                                                                                                     |  49 MB     00:49   

Metadata Cache Created


3、测试安装

[root@master ~]# yum install -y git
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                 | 3.7 kB     00:00     
extras                                                                                                                                               | 3.4 kB     00:00     
updates                                                                                                                                              | 3.4 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.7.1-4.el6_7.1 will be installed
--> Processing Dependency: perl-Git = 1.7.1-4.el6_7.1 for package: git-1.7.1-4.el6_7.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.7.1-4.el6_7.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.7.1-4.el6_7.1.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17015-4.el6 will be installed
---> Package perl-Git.noarch 0:1.7.1-4.el6_7.1 will be installed
--> Finished Dependency Resolution


Dependencies Resolved


=============================================================================
 Package                                   Arch                                  Version                                          Repository                           Size
============================================================================
Installing:
 git                                       x86_64                                1.7.1-4.el6_7.1                                  base                                4.6 M
Installing for dependencies:
 perl-Error                                noarch                                1:0.17015-4.el6                                  base                                 29 k
 perl-Git                                  noarch                                1.7.1-4.el6_7.1                                  base                                 28 k


Transaction Summary
===============================================================================
Install       3 Package(s)


Total download size: 4.7 M
Installed size: 15 M
Downloading Packages:
(1/3): git-1.7.1-4.el6_7.1.x86_64.rpm                                                                                                                | 4.6 MB     00:04     
(2/3): perl-Error-0.17015-4.el6.noarch.rpm                                                                                                           |  29 kB     00:00     
(3/3): perl-Git-1.7.1-4.el6_7.1.noarch.rpm                                                                                                           |  28 kB     00:00     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       1.0 MB/s | 4.7 MB     00:04     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:perl-Error-0.17015-4.el6.noarch                                                                                                                        1/3 
  Installing : git-1.7.1-4.el6_7.1.x86_64                                                                                                                               2/3 
  Installing : perl-Git-1.7.1-4.el6_7.1.noarch                                                                                                                          3/3 
  Verifying  : perl-Git-1.7.1-4.el6_7.1.noarch                                                                                                                          1/3 
  Verifying  : 1:perl-Error-0.17015-4.el6.noarch                                                                                                                        2/3 
  Verifying  : git-1.7.1-4.el6_7.1.x86_64                                                                                                                               3/3 

Installed:
  git.x86_64 0:1.7.1-4.el6_7.1                                                                                                                                              

Dependency Installed:
  perl-Error.noarch 1:0.17015-4.el6                                                    perl-Git.noarch 0:1.7.1-4.el6_7.1                                                   

Complete!

1 0
原创粉丝点击