配置阿里yum源

1,005 阅读1分钟

1.创建仓库文件

vim /etc/yum.repos.d/al_6.repo
 
[base]
name=centos-6-Base
baseurl=https://mirrors.aliyun.com/centos/6.10/os/x86_64/
gpgcheck=0

[epel]
name=CentOS-6-epel
baseurl=https://mirrors.aliyun.com/epel/6/x86_64/
gpgcheck=0

[update]
name=CentOS-6-update
baseurl=https://mirrors.aliyun.com/centos/6.10/updates/x86_64/
gpgcheck=0

[extras]
name=CentOS-6-extra
baseurl=https://mirrors.aliyun.com/centos/6.10/extras/x86_64/
gpgcheck=0

vim /etc/yum.repos.d/al_7.repo
 
[base]
name=centos-7-Base
baseurl=https://mirrors.aliyun.com/centos/7.7.1908/os/x86_64/
gpgcheck=0

[epel]
name=CentOS-7-epel
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=0

[update]
name=CentOS-7-update
baseurl=https://mirrors.aliyun.com/centos/7.7.1908/updates/x86_64/
gpgcheck=0

[extras]
name=CentOS-7-extra
baseurl=https://mirrors.aliyun.com/centos/7.7.1908/extras/x86_64/
gpgcheck=0
vim /etc/yum.repos.d/al_8.repo
 
[AppStream]
name=centos-8-Base
baseurl=https://mirrors.aliyun.com/centos/8.1.1911/AppStream/x86_64/os/
gpgcheck=0

[base]
name=centos-8-Base
baseurl=https://mirrors.aliyun.com/centos/8.1.1911/BaseOS/x86_64/os/
gpgcheck=0

[epel]
name=CentOS-$releasever-epel
baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64/
gpgcheck=0

[extras]
name=CentOS-8-extra
baseurl=https://mirrors.aliyun.com/centos/8.1.1911/extras/x86_64/os/
gpgcheck=0

2.创建yum缓存

yum clean all 
yum makecache

2020-3-12-6:24

# yum makecache/repolist 均出现报错
failure: repodata/26fa003aef3af2574dc96d76487f5c6d1ec0bdeb24481a6dbb1dcba2582198ce-filelists.sqlite.bz2 from epel: [Errno 256] No more mirrors to try.
https://mirrors.aliyun.com/epel/7/x86_64/repodata/26fa003aef3af2574dc96d76487f5c6d1ec0bdeb24481a6dbb1dcba2582198ce-filelists.sqlite.bz2: [Errno 14] HTTPS Error 404 - Not Found

# 原因:用了老的缓存,没有清理
# 解决,清理老缓存,重新创建缓存
yum clean all 
yum cache