0%

CentOS7系统更换软件安装源

阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/

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

1
2
3
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 软件。

1
2
yum update --skip-broken
yum -y install wget

安装完成更新下载源

1
2
3
4
5
6
# 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生成缓存

1
2
yum clean all
yum makecache

yum 安装报错

1
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

中国开源镜像站点

---------------- The End ----------------
Frank wechat
扫描+微信,共同学习.