Centos更换阿里云的yum安装源

in 互联网技术 with 0 comment  访问: 293 次

1. 备份默认官方的Base源:

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak

2. 替换Base安装源:

# Centos6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

# 没有wget命令curl也行
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


# Centos7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 没有wget命令curl也行
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. 同时添加阿里云EPEL源

# Centos6
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

# Centos7
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

4. 清除并重新生成包缓存信息

yum clean all
yum makecache
WeZan
Responses