当前位置:网站首页>【Redhat】新系统yum源配置

【Redhat】新系统yum源配置

2022-08-06 06:55:32忽悠局_局座

一、说在前面

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

二、前提

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

三、从阿里云获取

其实并不用备份,毕竟在原来的redhat.repo里面毛都没有
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[[email protected] 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])

在这里插入图片描述

然后得到的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

四、清除缓存

yum clean all
[[email protected] 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 文件已删除

在这里插入图片描述

五、查看yum仓库

yum repolist
[[email protected] 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

在这里插入图片描述

六、生成缓存

yum makecache
[[email protected] 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    
元数据缓存已建立。

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

原网站

版权声明
本文为[忽悠局_局座]所创,转载请带上原文链接,感谢
https://zxw-nudt.blog.csdn.net/article/details/126120605

随机推荐