1、本地yum源
[root@openstack ~]# mount /dev/sr0 /mnt/

[root@openstack ~]# echo "/dev/sr0/mnt iso9660 defaults 0 0" >> /etc/fstab

[root@openstack ~]# rm -rf/etc/yum.repos.d/*

[root@openstack ~]# cat >/etc/yum.repos.d/rhel6.repo <

[rhel6-source]

name=rhel6-source

baseurl=file:///mnt

enabled=1

gpgcheck=0

EOF

2、配置阿里云网络yum源

阿里云镜像源站点(http://mirrors.aliyun.com/)。

centos镜像参考:http://mirrors.aliyun.com/help/centos

CentOS

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/

CentOS 5

wget -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

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、之后运行yum makecache生成缓存

RHEL系统配置:

[root@openstack ~]# yum clean all

[root@openstack ~]# yum list

[root@openstack ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

[root@openstack ~]# sed -i 's/$releasever/6.7/g' /etc/yum.repos.d/CentOS-Base.repo

[root@openstack ~]# yum clean all

[root@openstack ~]# yum list

3、配置阿里云epel源:

配置参考:http://mirrors.aliyun.com/help/epel

epel

1、备份(如有配置其他epel源)

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

2、下载新repo 到/etc/yum.repos.d/

epel(RHEL 7)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

epel(RHEL 6)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

epel(RHEL 5)

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo