首先,将目录切换至/etc/yum.repos.d,这个是需要更换的yum源,一般系统都自带有yum源,但是下载速度很慢,所以需要将yum源换为国内的yum源,
这里一般有两种方法:
1、首先使用wget 下载阿里云的yum源
如果没有wget 可以使用yum -y install wget 下载
wget http://mirrors.aliyun.com/repo/Centos-7.repo
2、备份现有的yum源后,更改yum源的内容
cp CentOS-Base.repo CentOS-Base.repo.bak
这是原来的yum源的内容
将原yum的内容更改为下满内容
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
之后执行下面操作,清除yum下载文件,制作缓存,升级rpm包同时也升级软件和系统内核。
yum clean all
yum makecache文章来源:https://www.toymoban.com/news/detail-837465.html
yum update文章来源地址https://www.toymoban.com/news/detail-837465.html
到了这里,关于阿里云的yum源配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!