CentOS 6 yum源   更换成阿里云扩展源


第一种:                  

1、rm -rf /etc/yum.repos.d/*    (执行此操作的时候记得事先装好wget    不然 你就得挂载光盘用rpm装wget了。)
2、wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo http://mirrors.aliyun.com/repo/Centos-6.repo

这个时候,执行 yum repolist的结果如下


[root@di02 ~]# yum repolist


已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com

3.换源成功


第二种:

1:备份你的原镜像文件,以免出错后可以恢复。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2:下载新的CentOS-Base.repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


3:执行以下命令生成缓存


yum clean all

yum makecache


4:执行命令 yum repolist,结果如下换源成功

wKiom1eFjz7jqzFKAABSsukwnfQ861.png-wh_50



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章