本文主要是介绍yum源更换为阿里源及制作yum本地源,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一.更换yum源为阿里源
1.由于centos自带的yum源在国内使用时有时候速度会很慢,导致yum在线安装速度缓慢。这时候就需要yum源为国内的一些镜像站点。
2.首先访问阿里云镜像站点:http://mirrors.aliyun.com
3.选择对应的linux发行版(此次使用CentOS Linux release 7.4.1708进行测试)
4.进入7.6.1810版本,此次准备创建4个repo
1)os/:即发行版光盘上附带的所有基础rpm包
2)updates/ :所有更新的rpm包
3)extras/ :附带的一些额外包
4)centosplus/ :额外增添的一些包
5.找到repodata所在目录并记录其路径:
6.repo的配置文件在/etc/yum.repos.d/*repo,制作名称为CentOS-Base.repo;并将之前的CentOS-Base.repo更改为CentOS-Base.repo.apk
1)开始编辑CentOS-Base.repo文件
[aliyun] 仓库ID
name=this is os repo 仓库介绍
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/ repo链接,$releasever为版本号,$basearch为基础架构
enabled=1 开启仓库
gpgcheck=1 检查其rpm包的合法性及完整性
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 秘钥地址
7.依据上面步骤添加剩余三个仓库,并且将网易镜像链接也添加进来做防范措施.。
[aliyun]
name=this is os repo
failovermethod=priority 出错防范措施,为顺序执行
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/https://mirrors.163.com/centos/$releasever/os/$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#https://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7[updates]
name=this is updates repo
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/updates/$basearch/https://mirrors.163.com/centos/$releasever/updates/$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#https://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7[centosplus]
name=this is centosplus repo
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/https://mirrors.163.com/centos/$releasever/centosplus/$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#https://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7[extras]
name=this is extras repo
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/https://mirrors.163.com/centos/$releasever/extras/$basearch
enabled=1
gpgcheck&
这篇关于yum源更换为阿里源及制作yum本地源的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!