CentOS安裝完畢後,默認的yum源是國外的,國內訪問速度很慢,須要切換爲國內的源,這裏選用的是阿里雲的源。此外,一些經常使用的倉庫,如epel和ius,最好也一併安裝了。centos
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
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
CentOS 6bash
wget -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
yum install -y epel-release
若是以上命令不起做用:centos7
CentOS/RHEL 7code
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
CentOS/RHEL 6rem
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
CentOS/RHEL 5get
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
RHEL 5it
rpm -Uvh https://rhel5.iuscommunity.org/ius-release.rpm
RHEL 6class
rpm -Uvh https://rhel6.iuscommunity.org/ius-release.rpm
RHEL 7
rpm -Uvh https://rhel7.iuscommunity.org/ius-release.rpm
CentOS 5
rpm -Uvh https://centos5.iuscommunity.org/ius-release.rpm
CentOS 6
rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm
CentOS 7
rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm
CentOS/RHEL 7
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
CentOS/RHEL 6
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
CentOS/RHEL 5
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
yum repolist
yum makecache