Skip to content

Latest commit

 

History

History
74 lines (57 loc) · 2.18 KB

CentOS7更换yum软件镜像源.md

File metadata and controls

74 lines (57 loc) · 2.18 KB

CentOS7系统更换软件安装源

阿里云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

中国开源镜像站点