阅读背景:

阿里云Centos镜像源和EPEL源

来源:互联网 

Centos配置yum本地源aliyun的EPEL源


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

> [rhel6-source]

> name=rhel6-source

> baseurl=file:///mnt

> enabled=1

> gpgcheck=0

> EOF

 

2、配置阿里云网络yum

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

centos镜像参考:https://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.repohttps://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

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

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repohttps://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 https://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源:

配置参考:https://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 https://mirrors.aliyun.com/repo/epel-7.repo

           

epel(RHEL 6)

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

           

epel(RHEL 5)

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

            


本文出自 “技术成就梦想” 博客,请务必保留此出处https://andyliu.blog.51cto.com/518879/1852147


分享到: