在国内直接访问 CentOS 官方的 yum 源软件下载速度较慢,且有些软件没有。因此,我们将介绍怎样将 yum 的源指向国内阿里巴巴的源。
以下为修改Centos6.5的yum源:
1. 备份原镜像文件,便于后期恢复
[root@keepmydream ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载新的CentOS-Base.repo 到/etc/yum.repos.d/
Centos5地址:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-5.repo
Centos6地址:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
Centos7地址:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
如果你电脑没有安装 wget,可以直接使用浏览器访问 URL 地址,将 repo 下载下来,然后通过 FTP 传送到服务器即可。或者使用“yum -y install wget”安装即可。
3. 清除缓存
yum clean all
4. 生成缓存
yum makecache