centos 7 yum修改为阿里云镜像
记录一下问题:
两台centos,用yum install 安装软件,一台成功,一台失败
查看yum源
yum repolist enabled
发现两台机器镜像源不一致
疑问:centos安装的方法一致,但yum源不一样,不知道为什么
yum源有 阿里云、网易、163 等
此处是设置为阿里云镜像
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/
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、之后运行yum makecache生成缓存
此时 在 yum install 软件,即能使用阿里云镜像源