Centos 6.5更换yum的源为阿里和网易的源

版权声明:转载或者应用请注明出处 https://blog.csdn.net/qq_35180983/article/details/82467169

1、本机源所在的目录:  /etc/yum.repos.d/,下面是该目录下的文件,注意:在更换之前可以先备份自己的源,防止出错

[root@hadoop01 home]# ll /etc/yum.repos.d/
-rw-r--r--. 1 root root 1926 Nov 27  2013 CentOS-Base.repo
-rw-r--r--. 1 root root  638 Nov 27  2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  630 Nov 27  2013 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 Nov 27  2013 CentOS-Vault.repo

2、Centos 6.X 安装阿里或者网易的源

6.X的阿里源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo      

6.x的网易的源: wget http://mirrors.163.com/.help/CentOS6-Base-163.repo   

3、下载成功以后执行yum clean all 命令,然后执行yum makecache 命令

[root@hadoop01 yum.repos.d]# yum clean all 
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@hadoop01 yum.repos.d]# 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                                                      | 242 kB     00:01     
base/filelists_db                                                  | 6.4 MB     01:13     
base/primary_db                                                    | 4.7 MB     00:24     
base/other_db                                                      | 2.8 MB     00:15     
extras                                                             | 3.4 kB     00:00     
extras/filelists_db                                                |  24 kB     00:00     
extras/prestodelta                                                 | 1.1 kB     00:00     
extras/primary_db                                                  |  25 kB     00:00     
extras/other_db                                                    |  28 kB     00:00     
updates                                                            | 3.4 kB     00:00     
updates/filelists_db                                               | 852 kB     00:02     
updates/prestodelta                                                |  36 kB     00:00     
updates/primary_db                                                 | 1.2 MB     00:03     
updates/other_db                                                   |  17 MB     01:19     
Metadata Cache Created
[root@hadoop01 yum.repos.d]# 

4、当yum makecache完成以后,源就安装完了

[root@hadoop01 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                   repo name                                                 status
base                      CentOS-6 - Base - mirrors.aliyun.com                      6,713
extras                    CentOS-6 - Extras - mirrors.aliyun.com                       31
updates                   CentOS-6 - Updates - mirrors.aliyun.com                     122
repolist: 6,866

猜你喜欢

转载自blog.csdn.net/qq_35180983/article/details/82467169