CentOS換源
-
YUM源
-
備份原來的
repo
文件mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
在CentOS中配置使用網易或阿里的開源鏡像
開源鏡像站中有相應教程,下面使用阿里的源。
-
下載新的
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
-
-
之后運行
yum clean all yum makecache
生成緩存
-
-
EPEL源
EPEL源在CentOS默認不存在,需要下載安裝
yum list | grep epel-release yum install epel-release
安裝完成后,在
/etc/yum.repos.d
多出如下兩個文件epel-testing.repo epel.repo
下載阿里開源鏡像的EPEL源
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
之后運行
yum clean all yum makecache
生成緩存