在CentOS 8中,使用yum时出现错误,镜像列表中没有url,类似如下:

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

原因

在2022年1月31日,CentOS团队从官方镜像中移除CentOS 8的所有包。CentOS 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。

CentOS 8已于2021年12月31日寿终正寝,但软件包仍在官方镜像上保留了一段时间。现在他们被转移到 https://vault.centos.org

解决方法

如果你仍然需要运行CentOS 8,你可以在/etc/yum.repos.d中更新一下源。使用 vault.centos.org 代替mirror.centos.org

[root@centos8 yum.repos.d]# sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
[root@centos8 yum.repos.d]# sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*

本质上是用仍在运行的URL替换之前的URL

centos8配置阿里云yum源

centos8(centos8官方源已下线,建议切换centos-vault源)

## 官方站点
https://mirrors.aliyun.com/centos-vault/ ## 下载centos8.5仓库配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo ## 常用配置 [base] [extras] [AppStream] vim Centos-vault-8.5.2111.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

配置epel源

## 安装 epel 配置包
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm ## 将 repo 配置中的地址替换为阿里云镜像站地址
sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel* 或
[epel]
name=EPEL
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch/
gpgcheck=0
enabled=1

CentOS 8: yum仓库配置的更多相关文章

  1. Linux yum仓库配置

    yum仓库配置 10.1 概述 YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器.基于RPM包 ...

  2. CentOS7之yum仓库配置

    操作系统版本:CentOS Linux release 7.2.1511 (Core)  Yum软件版本:yum-3.4.3-132.el7.centos.0.1.noarch  Yum主配置文件:/ ...

  3. centOS下yum安装配置samba

     centOS下yum安装配置samba 2010-03-29 15:46:00 标签:samba yum centOS 安装 休闲 注意:本文的原则是只将文件共享应用于内网服务器,并让将要被共享的目 ...

  4. RedHat使用Centos的yum仓库

    RedHat使用Centos的yum仓库 卸载红帽yum源 [root@zhouwanchun ~]# rpm -qa | grep yum [root@zhouwanchun ~]# rpm -e ...

  5. CentOS本地yum源配置

    现有一台处在局域网的linux服务器,无法ping通外网,本文是关于本地yum源的配置 环境 : CentOS 6.5 一 .挂载CentOS镜像文件 (1) 创建挂载文件夹,若此文件夹已存在可忽略 ...

  6. 设置centos的yum仓库源为阿里源

    前提 使我们的主机能够连接到外网 cd /etc/yum.repos.d/ #切换到yum仓库目录下 rm -rf * #删除默认配置仓库 wget -O /etc/yum.repos.d/CentO ...

  7. yum仓库配置与内网源部署记录

    使用yum的好处主要就是在于能够自动解决软件包之间的依赖.这使得维护更加容易.这篇文章主要就是记录部署内网源的操作过程以及yum工具如何使用 因为需要.数据库要从Oracle迁移至MySQL.在部署M ...

  8. YUM仓库配置

    YUM的前身是YUP(Yellow dog Updater,Yellow dog Linux的软件更新器),最初由TSS公司(Terra Soft Solutions,INC.)使用Python语言开 ...

  9. Centos下YUM源配置及相关问题应用篇

    yum源配置在工作中会经常用到,特别是安装数据库时,一个个去安装依赖包比较耗时,直接配置好yum安装即可. (特别提醒:redhat有时会提示系统未注册,要求你注册,这个只对需要连接公网的yum源产生 ...

随机推荐

  1. C# 实例解释面向对象编程中的单一功能原则

    在面向对象编程中,SOLID 是五个设计原则的首字母缩写,旨在使软件设计更易于理解.灵活和可维护.这些原则是由美国软件工程师和讲师罗伯特·C·马丁(Robert Cecil Martin)提出的许多原 ...

  2. 数论同余学习笔记 Part 2

    逆元 准确地说,这里讲的是模意义下的乘法逆元. 定义:如果有同余方程 \(ax\equiv 1\pmod p\),则 \(x\) 称为 \(a\bmod p\) 的逆元,记作 \(a^{-1}\). ...

  3. Docker版本Jenkins的使用

    一. 什么是Jenkins Jenkins是当前非常流行的一款持续集成工具,可以帮助大家把更新后的代码自动部署到服务器上运行. 二. 为什么用docker版的Jenkins Jenkins主要有三种安 ...

  4. 为什么内部类调用的外部变量必须是final修饰的?

    感谢原文:https://blog.csdn.net/u010393325/article/details/80643636 因为生命周期的原因.方法中的局部变量,方法结束后这个变量就要释放掉,fin ...

  5. linux计划任务之cron

    目录 cron计划任务之用户级 cron计划任务之系统级 cron计划任务之用户级 1.安装crond centos7 执行命令: # yum install -y crontabs /bin/sys ...

  6. webpack4 处理CSS

    本篇讲解webpack4中打包css的应用.v4 版本和 v3 版本并没有特别的出入. 教程所示图片使用的是 github 仓库图片,网速过慢的朋友请移步>>> 原文地址. 评论或者 ...

  7. MyBatis动态SQL和缓存

    1. 什么是动态SQL 静态SQL:静态SQL语句在程序运行前SQL语句必须是确定的,SQL语句中涉及的表的字段名必须是存在的,静态SQL的编译是在程序运行前的. 动态SQL:动态SQL语句是在程序运 ...

  8. Note - 多项式乱写

      基础篇戳这里.   大概是记录 @Tiw 的伟大智慧叭.   嗷,附赠一个 全家桶题. 目录 Newton 迭代法 多项式乱算 多项式求逆 多项式 多项式 多项式开根 多项式带余除法 多项式快速幂 ...

  9. Unreal ListView使用篇

    应用 ListView,在Unreal UI界面开发中用途非常广泛,基本只要你使用列表,就得需要用ListView.比如排行榜100个列表,界面上只需要显示出10个,我们肯定不能生成100个ui实例, ...

  10. 《操作系统导论》第14章 | 内存操作API

    内存类型 在运行一个C程序的时候,会分配两种类型的内存.第一种称为栈内存,它的申请和释放操作是编译器来隐式管理的,所以有时也称为自动内存.假设需要在func()函数中为一个整形变量x申请空间,我们只需 ...