CentOS7系统更换软件安装源

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

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

2.下载新的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

3.运行yum makecache生成缓存

yum clean all
yum makecache

参考链接: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
https://t.goodrain.com/t/topic/236

posted @ 2018-01-24 09:40  二十亿光年的孤独  阅读(8751)  评论(0编辑  收藏  举报