一、本地yum源
[root@openstack ~]# mount /dev/sr0 /mnt/centos
[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 <<EOFide
[rhel6-source]阿里雲
name=rhel6-sourceurl
baseurl=file:///mntget
enabled=1it
gpgcheck=0class
EOFtest
二、配置阿里雲網絡yum源
阿里雲鏡像源站點(http://mirrors.aliyun.com/)。
centos鏡像參考:http://mirrors.aliyun.com/help/centos
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 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
三、以後運行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
三、配置阿里雲epel源:
配置參考:http://mirrors.aliyun.com/help/epel
epel
一、備份(若有配置其餘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
二、下載新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