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.repohttp://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.repohttp://mirrors.aliyun.com/repo/Centos-6.repo


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


yumclean all

yum makecache


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

wKiom1eFjz7jqzFKAABSsukwnfQ861.png-wh_50

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim /etc/sysconfig/network-scripts/ifcfg-eth0 B...