阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 。
第一步:备份你的原镜像文件,以免出错后可以恢复。
cp /etc/yum.repos.d/CentOS-Base.repo{,.backup}
# 或者
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
如果 wget 没有安装,运行下面命令安装 wget 软件。
yum update --skip-broken
yum -y install wget
安装完成更新下载源
# CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
# CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
第三步:运行yum makecache生成缓存
yum clean all
yum makecache
如果yum 安装报错
File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:
解决:修改文件/usr/bin/yum、/usr/libexec/urlgrabber-ext-down头中相应python为#!/usr/bin/python2.7
163官方说明:
http://mirrors.163.com/
http://mirrors.163.com/.help/centos.html
中国开源镜像站点
- 阿里云开源镜像站:http://mirrors.aliyun.com/
- 网易开源镜像站:http://mirrors.163.com/
- 搜狐开源镜像站:http://mirrors.sohu.com/
- 北京交通大学:http://mirror.bjtu.edu.cn/cn/ <教育网荐>
- 兰州大学:http://mirror.lzu.edu.cn/ <西北高校FTP搜索引擎>
- 厦门大学:http://mirrors.xmu.edu.cn/
- 上海交通大学:http://ftp.sjtu.edu.cn/
- 清华大学:http://mirrors.tuna.tsinghua.edu.cn/
http://mirrors.6.tuna.tsinghua.edu.cn/
http://mirrors.4.tuna.tsinghua.edu.cn/ - 天津大学:http://mirror.tju.edu.cn/
- 中国科学技术大学:http://mirrors.ustc.edu.cn/
http://mirrors4.ustc.edu.cn/ <教育网、电信>
http://mirrors6.ustc.edu.cn/ - 西南大学:http://linux.swu.edu.cn/swudownload/
- 泰安移动:http://mirrors.ta139.com/
- 东北大学:http://mirror.neu.edu.cn/
- 浙江大学:http://mirrors.zju.edu.cn/
- 东软信息学院:http://mirrors.neusoft.edu.cn/
转载自:https://github.com/jaywcjlove/handbook/blob/master/CentOS/CentOS7%E6%9B%B4%E6%8D%A2yum%E8%BD%AF%E4%BB%B6%E9%95%9C%E5%83%8F%E6%BA%90.md?_blank