一、更新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/
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3、运行yum makecache生成元数据缓存
$ yum makecache
二、添加epel源
1、下载epel源
$ wget -O /tmp/epel-release-6-8.noarch.rpm http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
2、安装epel源
$ rpm -ivh /tmp/epel-release-6-8.noarch.rpm
3、更新缓存
$ yum makecache
三、添加nginx源
1、下载nginx源
$ wget -O /tmp/nginx-release-centos-6-0.el6.ngx.noarch.rpm http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
2、安装nginx源
$ rpm -ivh /tmp/nginx-release-1.12.1-1.el6.ngx.noarch.rpm
3、更新缓存
$ yum makecache
四、添加remi源
1、下载remi源
$ wget -O /tmp/remi-release-6.rpm http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
2、安装remi源
$ rpm -ivh /tmp/remi-release-6.rpm
3、更新缓存
$ yum makecache
五、添加mysql源
1、下载mysql源
$ wget -O /tmp/mysql-community-release-el6-5.noarch.rpm http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
2、安装mysql源
$ rpm -ivh /tmp/mysql-community-release-el6-5.noarch.rpm
3、更新缓存
$ yum makecache
以上就是CentOS 6 Yum源配置的详细步骤。通过更新、添加不同的源,我们可以获得更多的软件包,并快速高效地安装需要的软件。