CentOS7.9.2009的yum更换vault地窖保险库过期源,epel的archive归档源 笔记241117
备份 /etc/yum.repos.d
文件夹
bash
tempUri=/etc/yum.repos.d ; sudo cp -a $tempUri $tempUri.$(date +%0y%0m%0d%0H%0M%0Sns%0N).bak
清空 /etc/yum.repos.d
文件夹
bash
sudo rm -rf /etc/yum.repos.d/*
在 /etc/yum.repos.d
下,新建 xxx.repo
文件
名字随便取, 以.repo
结尾 可以叫 CentOS-Base.repo
, 也可以叫 a.repo
bash
sudo vi /etc/yum.repos.d/CentOS-Base.repo
或
bash
sudo vi /etc/yum.repos.d/a.repo
xxx.repo
文件内容如下
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/os/$basearch/
http://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/7.9.2009/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/7.9.2009/os/$basearch/
http://archive.kernel.org/centos-vault/7.9.2009/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/7.9.2009/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirror.nsc.liu.se/centos-store/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/7.9.2009/updates/$basearch/
http://archive.kernel.org/centos-vault/7.9.2009/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/7.9.2009/extras/$basearch/
http://archive.kernel.org/centos-vault/7.9.2009/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[epel-archive]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/7.9/$basearch
http://mirrors.aliyun.com/epel-archive/7.8/$basearch
http://mirrors.aliyun.com/epel-archive/7/$basearch
http://mirrors.aliyun.com/epel/7/$basearch
https://archives.fedoraproject.org/pub/archive/epel/7/$basearch
http://mirrors.cloud.tencent.com/epel-archive/7/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/7/$basearch
http://archives.fedoraproject.org/pub/archive/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
保存退出后, 重建yum缓存
bash
sudo yum clean all; sudo yum makecache;
一气呵成
bash
### 备份
tempUri=/etc/yum.repos.d ; sudo cp -a $tempUri $tempUri.$(date +%0y%0m%0d%0H%0M%0Sns%0N).bak
### 清空 `/etc/yum.repos.d` 文件夹
sudo rm -rf /etc/yum.repos.d/*
echo '
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/os/$basearch/
http://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/7.9.2009/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/7.9.2009/os/$basearch/
http://archive.kernel.org/centos-vault/7.9.2009/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/7.9.2009/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/7.9.2009/os/$basearch/
http://mirror.nsc.liu.se/centos-store/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/7.9.2009/updates/$basearch/
http://archive.kernel.org/centos-vault/7.9.2009/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/7.9.2009/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/7.9.2009/extras/$basearch/
http://archive.kernel.org/centos-vault/7.9.2009/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/7.9.2009/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[epel-archive]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/7.9/$basearch
http://mirrors.aliyun.com/epel-archive/7.8/$basearch
http://mirrors.aliyun.com/epel-archive/7/$basearch
http://mirrors.aliyun.com/epel/7/$basearch
https://archives.fedoraproject.org/pub/archive/epel/7/$basearch
http://mirrors.cloud.tencent.com/epel-archive/7/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/7/$basearch
http://archives.fedoraproject.org/pub/archive/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
' > /etc/yum.repos.d/CentOS-Base.repo
sudo yum clean all ; sudo yum makecache;