CentOS7.9.2009的yum更换vault地窖保险库过期源,epel的archive归档源 笔记241117

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;
相关推荐
初学者521312 分钟前
华为欧拉系统使用U盘制作引导安装华为欧拉操作系统
centos·华为欧拉系统安装·openculer
乐茵安全16 分钟前
shell脚本(4)一文解决比较运算符&用户交互
linux·服务器·数据库·网络安全
林农23 分钟前
C03S05-PLinux网络之自动装机
linux·网络·云计算
byte轻骑兵1 小时前
走进嵌入式开发世界
linux·arm开发·fpga开发·嵌入式开发
yimengsama1 小时前
npm | Yarn | pnpm Node.js包管理器比较与安装
前端·笔记·npm·node.js·pnpm·yarn
KwokRoot1 小时前
Linux-服务器辨别实体机OR虚拟机
linux·运维·服务器
誓约酱2 小时前
Linux 下网络套接字(Socket) 与udp和tcp 相关接口
linux·网络·c++·tcp/ip·udp
Winston Wood2 小时前
Linux性能优化之火焰图的起源
linux·运维·服务器·性能优化
hong1616882 小时前
CentOS中的Firewalld:全面介绍与实战应用
linux·python·centos