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