• 【Redhat】新系统yum源配置


    一、说在前面

    1、红帽的yum源要收费,作为技术人只能想点别的办法了,可以采用CentOS的yum源
    2、根据阿里云的提示,CentOS 8操作系统版本结束了生命周期,阿里云镜像站也移除了相应镜像源。如果您的业务过渡期仍需要使用CentOS 8中的一些安装包,建议切换至CentOS-Vault源

    二、前提

    yum仓库在/etc/yum.repos.d中的.repo中,首先进入到这个目录下
    [root@localhost ~]# cd /etc/yum.repos.d
    
    • 1

    三、从阿里云获取

    其实并不用备份,毕竟在原来的redhat.repo里面毛都没有
    wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
    
    • 1
    [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
    --2022-08-02 13:48:12--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
    正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 14.215.172.239, 14.215.172.241, 183.2.193.239, ...
    正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|14.215.172.239|:443... 已连接。
    已发出 HTTP 请求,正在等待回应... 200 OK
    长度:2495 (2.4K) [application/octet-stream]
    正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
    
    /etc/yum.repos.d/CentOS-Base.repo                    100%[=====================================================================================================================>]   2.44K  --.-KB/s  用时 0s      
    
    2022-08-02 13:48:12 (82.2 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2495/2495])
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    在这里插入图片描述

    然后得到的CentOS-Base.repo文件内容如下,不想下载的师傅可以直接复制然后粘到redhat.repo里面
    # CentOS-Base.repo
    #
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the 
    # remarked out baseurl= line instead.
    #
    #
     
    [base]
    name=CentOS-8.5.2111 - Base - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
            http://mirrors.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
    gpgcheck=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
     
    #additional packages that may be useful
    [extras]
    name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/
            http://mirrors.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/extras/$basearch/os/
    gpgcheck=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
     
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-8.5.2111 - Plus - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/centosplus/$basearch/os/
            http://mirrors.aliyuncs.com/centos-vault/8.5.2111/centosplus/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/centosplus/$basearch/os/
    gpgcheck=0
    enabled=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
     
    [PowerTools]
    name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/PowerTools/$basearch/os/
            http://mirrors.aliyuncs.com/centos-vault/8.5.2111/PowerTools/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/PowerTools/$basearch/os/
    gpgcheck=0
    enabled=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
    
    
    [AppStream]
    name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/$basearch/os/
            http://mirrors.aliyuncs.com/centos-vault/8.5.2111/AppStream/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/AppStream/$basearch/os/
    gpgcheck=0
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56

    四、清除缓存

    yum clean all
    
    • 1
    [root@localhost yum.repos.d]# yum clean all
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    17 文件已删除
    
    • 1
    • 2
    • 3
    • 4
    • 5

    在这里插入图片描述

    五、查看yum仓库

    yum repolist
    
    • 1
    [root@localhost yum.repos.d]# yum repolist 
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    仓库标识                                                仓库名称
    AppStream                                               CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
    base                                                    CentOS-8.5.2111 - Base - mirrors.aliyun.com
    extras                                                  CentOS-8.5.2111 - Extras - mirrors.aliyun.com
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    在这里插入图片描述

    六、生成缓存

    yum makecache
    
    • 1
    [root@localhost yum.repos.d]# yum makecache 
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                                                                                        384 kB/s | 4.6 MB     00:12    
    CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                                                                                       30 kB/s |  10 kB     00:00    
    CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                                                                                                   352 kB/s | 8.4 MB     00:24    
    元数据缓存已建立。
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    在这里插入图片描述
    这个时候就可以开始正常使用yum源了

  • 相关阅读:
    解密 MobaXterm 已经存储 Session 账号的密码
    在用户同意隐私政策前,您的应用获取了用户的ANDROID ID,不符合华为应用市场审核标准。
    使用Docker伪分布式安装hadoop
    DAY3-深度学习100例-卷积神经网络(CNN)服装图像分类
    vulnhub Potato: 1
    强化学习Thompson Sampling策略笔记
    分布式服务一篇概览
    使用Skonsole自动生成Git提交信息
    SpringBoot+Mybaits搭建通用管理系统实例五:登录健权框架实现上
    Spark入门
  • 原文地址:https://blog.csdn.net/ZXW_NUDT/article/details/126120605