一, CentOS 搭建 yum 源
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 5
- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
或者
- curl -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
或者
- curl -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
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
点解这里查看更多 -->https://opsx.alibaba.com/mirror https://opsx.alibaba.com/mirror
3, 之后运行 yum makecache 生成缓存
yum makecache
二, 搭建 EPEL 仓库
1, 在 CentOS6 和 CentOS7 都可以执行下面的命令安装 epel 仓库
yum -y install epel-release
2, 移除 epel 仓库
在 CentOS6 和 CentOS7 都可以执行下面的命令移除 epel 仓库
yum -y remove epel-release
3 , 查看仓库信息
yum repolist
来源: http://www.bubuko.com/infodetail-2741972.html