CentOS修改yum源为Aliyun

1、备份系统自带的yum

[[email protected] ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载和自己操作系统版本对应的yum源

[[email protected] ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2573  100  2573    0     0  11103      0 --:--:-- --:--:-- --:--:-- 11090

3、运行yum makecache生成缓存

[[email protected] ~]# yum makecache
已加载插件:fastestmirror
base                                                                                                                                                                    | 3.6 kB  00:00:00     
extras                                                                                                                                                                  | 3.4 kB  00:00:00     
updates                                                                                                                                                                 | 3.4 kB  00:00:00     
(1/8): extras/7/x86_64/prestodelta                                                                                                                                      |  48 kB  00:00:00     
(2/8): extras/7/x86_64/other_db                                                                                                                                         |  86 kB  00:00:01     
(3/8): extras/7/x86_64/filelists_db                                                                                                                                     | 485 kB  00:00:08     
(4/8): updates/7/x86_64/prestodelta                                                                                                                                     | 399 kB  00:00:07     
(5/8): updates/7/x86_64/other_db                                                                                                                                        | 341 kB  00:00:05     
(6/8): updates/7/x86_64/filelists_db                                                                                                                                    | 2.1 MB  00:00:27     
(7/8): base/7/x86_64/other_db                                                                                                                                           | 2.5 MB  00:00:30     
(8/8): base/7/x86_64/filelists_db                                                                                                                                       | 6.7 MB  00:00:45     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyuncs.com
 * extras: mirrors.aliyuncs.com
 * updates: mirrors.aliyuncs.com

元数据缓存已建立

4、vim /etc/yum.repos.d/CentOS-Base.repo
查看里面的内容,确实已经由系统自带的yum源替换为了阿里的yum源了


CentOS修改yum源为Aliyun


5、yum install iotop


[[email protected]~]# yum install iotop
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyuncs.com
 * extras: mirrors.aliyuncs.com
 * updates: mirrors.aliyuncs.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 iotop.noarch.0.0.6-2.el7 将被 安装
--> 解决依赖关系完成


依赖关系解决


===============================================================================================================================================================================================
 Package                                      架构                                          版本                                             源                                           大小
===============================================================================================================================================================================================
正在安装:
 iotop                                        noarch                                        0.6-2.el7                                        base                                         52 k


事务概要
===============================================================================================================================================================================================
安装  1 软件包


总下载量:52 k
安装大小:156 k
Is this ok [y/d/N]: y
Downloading packages:
iotop-0.6-2.el7.noarch.rpm                                                                                                                                              |  52 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : iotop-0.6-2.el7.noarch                                                                                                                                                     1/1 
  验证中      : iotop-0.6-2.el7.noarch                                                                                                                                                     1/1 


已安装:
  iotop.noarch 0:0.6-2.el7                                                                                                                                                                     


完毕!