centos7 curl#6 - Could not resolve host mirrorlist.centos.org; 未知的错误 解决方案
问题描述
centos7系统安装完成后,yum安装软件时报错“curl#6 - “Could not resolve host: mirrorlist.centos.org; 未知的错误””
[root@192 ~]# yum install vim -y
已加载插件:fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"One of the configured repositories failed (未知),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-manager repos --disable=<repoid>5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64
解决方案
1)执行如下命令:
vi /etc/yum.repos.d/CentOS-Base.repo
2)修改如下:
# 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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
3)配置成阿里云镜像
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
4)执行如下命令
yum repolist
yum clean all
yum makecache
Centos7安装gcc8
方法 1:使用 devtoolset安装 GCC 8(推荐)
1)安装 centos-release-scl
sudo yum install -y centos-release-scl
2)安装gcc 8
sudo yum install -y devtoolset-8
报错如下:
[root@192 yum.repos.d]# sudo yum install -y devtoolset-8
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"One of the configured repositories failed (未知),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-manager repos --disable=<repoid>5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: centos-sclo-rh/x86_64
解决方案:
修改CentOS-SCLo-scl.repo:
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
修改如下:
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
修改CentOS-SCLo-scl-rh.repo:
vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
修改如下:
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
执行如下命令:
yum repolist
yum clean all
yum makecache
3)重新执行命令
sudo yum install -y devtoolset-8
4)每次使用 GCC 8 时,需要运行:
scl enable devtoolset-8 bash
或者执行:
source /opt/rh/devtoolset-8/enable
5)如需永久启动gcc 8,执行如下命令:
echo "source /opt/rh/devtoolset-8/enable" >> ~/.bashrc
source ~/.bashrc
方法 2:使用 yum 直接安装 GCC 8(可能需要额外配置)
1)启用 EPEL 和 SCLo 仓库
sudo yum install -y epel-release
sudo yum install -y centos-release-scl
2)安装 GCC 8
sudo yum install -y gcc-toolset-8
3)启用 GCC 8
scl enable gcc-toolset-8 bash
4)检查 GCC 版本
gcc --version
方法 3:手动编译 GCC 8(适用于特殊需求)
1)安装依赖
sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc gcc-c++ make wget bzip2
2)下载 GCC 8 源码
wget http://ftp.gnu.org/gnu/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz
tar -xf gcc-8.5.0.tar.xz
cd gcc-8.5.0
3)下载依赖库
./contrib/download_prerequisites
4)编译安装
mkdir build && cd build
../configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc)
sudo make install
5)检查 GCC 版本
gcc --version
相关文章:
centos7 curl#6 - Could not resolve host mirrorlist.centos.org; 未知的错误 解决方案
问题描述 centos7系统安装完成后,yum安装软件时报错“curl#6 - “Could not resolve host: mirrorlist.centos.org; 未知的错误”” [root192 ~]# yum install vim -y 已加载插件:fastestmirror Determining fastest mirrors Could not retrieve mirro…...
【前端发展路径】技术成长路径、职业方向分支、行业趋势与建议、学习资源推荐
前端开发是一个快速发展的领域,技术栈和职业路径也在不断演进。以下是前端开发的典型发展路径,分为技术成长和职业方向两个维度,供参考: 一、技术成长路径 1. 初级阶段(入门) 核心技能: HTML/CSS:语义化标签、布局(Flex/Grid)、响应式设计、CSS 预处理器(Sass/Less…...
NO.15十六届蓝桥杯备战|while循环|六道练习(C++)
while循环 while语法形式 while 语句的语法结构和 if 语句⾮常相似,但不同的是 while 是⽤来实现循环的, if 是⽆法实现循环的。 下⾯是 while 循环的语法形式: //形式1 while ( 表达式 )语句; //形式2 //如果循环体想包含更多的语句&a…...
kotlin标准库里面也有很多java类
Kotlin 标准库中确实存在许多与 Java 类直接关联或基于 Java 类封装的结构,但这并不是“问题”,而是 Kotlin 与 JVM 生态深度兼容和互操作性的体现。以下从技术原理和设计哲学的角度详细解释: 一、Kotlin 与 JVM 的底层关系 Kotlin 代码最终…...
Flutter 双屏双引擎通信插件加入 GitCode:解锁双屏开发新潜能
在双屏设备应用场景日益丰富的当下,移动应用开发领域迎来了新的机遇与挑战。如何高效利用双屏设备优势,为用户打造更优质的交互体验,成为开发者们关注的焦点。近日,一款名为 Flutter 双屏双引擎通信插件的创新项目正式入驻 GitCod…...
01、单片机上电后没有正常运行怎么办
单片机上电后没有运转, 首先要检查什么? 1、单片机供电是否正常? &电路焊接检查 如果连最基本的供电都没有,其它都是空谈啊!检查电路断路了没有?短路了没有?电源合适吗?有没有虚焊? 拿起万用表之前,预想一下测量哪里?供电电压应该是多少?对PCB上电压测量点要…...
使用 EMQX 接入 LwM2M 协议设备
LwM2M 协议介绍 LwM2M 是一种轻量级的物联网设备管理协议,由 OMA(Open Mobile Alliance)组织制定。它基于 CoAP (Constrained Application Protocol)协议,专门针对资源受限的物联网设备设计,例…...
【Elasticsearch】bool查询
Elasticsearch 的bool查询是构建复杂查询条件的核心工具之一。它允许通过布尔逻辑组合多个查询子句,以实现精确的搜索需求。bool查询支持四种主要的子句类型:must、should、filter和must_not。每种子句类型都有其特定的作用和行为。 1.bool查询的基本结构…...
Redis 常见面试题汇总(持续更新)
文章目录 01、Redis 支持哪些数据类型?02、谈谈对 Redis 的 AOF 机制的 rewrite 模式的理解?03、请列举几个 Redis 常见性能问题和解决方案04、Redis 使用的最大内存是多少?内存数据淘汰策略有哪些?05、请谈谈 Redis 的同步机制。…...
蓝桥杯备赛 Day13.1走出迷宫
链接:走出迷宫 题目描述 小明现在在玩一个游戏,游戏来到了教学关卡,迷宫是一个N*M的矩阵。 小明的起点在地图中用“S”来表示,终点用“E”来表示,障碍物用“#”来表示,空地用“.”来表示。 障碍物不能通…...
全面解析鸿蒙(HarmonyOS)开发:从入门到实战,构建万物互联新时代
文章目录 引言 一、鸿蒙操作系统概述二、鸿蒙开发环境搭建三、鸿蒙核心开发技术1. **ArkUI框架**2. **分布式能力开发**3. **原子化服务与元服务** 四、实战案例:构建分布式音乐播放器五、鸿蒙开发工具与调试技巧六、鸿蒙生态与未来展望结语 引言 随着万物互联时代…...
使用 mkcert 本地部署启动了 TLS/SSL 加密通讯的 MongoDB 副本集和分片集群
MongoDB 是支持客户端与 MongoDB 服务器之间启用 TLS/SSL 进行加密通讯的, 对于 MongoDB 副本集和分片集群内部的通讯, 也可以开启 TLS/SSL 认证. 本文会使用 mkcert 创建 TLS/SSL 证书, 基于创建的证书, 介绍 MongoDB 副本集、分片集群中启动 TLS/SSL 通讯的方法. 我们将会在…...
P3372 【模板】线段树 1【题解2】
本题题解分两篇 此篇为第贰篇,用树状数组做 第壹篇:P3372 【模板】线段树 1【题解1】 本文讲解树状数组解决区间修改区间查询 其它树状数组相关文章: 树状数组讲解单点修改/查询树状数组解决区间修改单点查询 P3372 【模板】线段树 1 题…...
使用 EDOT 监测由 OpenAI 提供支持的 Python、Node.js 和 Java 应用程序
作者:来自 Elastic Adrian Cole Elastic 很自豪地在我们的 Python、Node.js 和 Java EDOT SDK 中引入了 OpenAI 支持。它们为使用 OpenAI 兼容服务的应用程序添加日志、指标和跟踪,而无需任何代码更改。 介绍 去年,我们宣布了 OpenTelemetry…...
kotlin中expect和actual关键字修饰的函数作用
在 Kotlin 多平台编程中,expect 和 actual 关键字用于定义跨平台的抽象和具体实现。这种机制允许开发者声明一个平台无关的接口或函数签名(使用 expect),然后在每个目标平台上提供具体的实现(使用 actual)。…...
CNN-BiGRU卷积神经网络双向门控循环单元多变量多步预测,光伏功率预测
CNN-BiGRU卷积神经网络双向门控循环单元多变量多步预测,光伏功率预测 代码下载:CNN-BiGRU卷积神经网络双向门控循环单元多变量多步预测,光伏功率预测 一、引言 1.1、研究背景及意义 随着全球能源危机和环境问题的日益严重,可再…...
mysql8.0使用MGR实现高可用与利用MySQL Router构建读写分离MGR集群
MGR是MySQL Group Replication的缩写,即MySQL组复制。 在以往,我们一般是利用MySQL的主从复制或半同步复制来提供高可用解决方案,但这存在以下几个比较严重的问题: 主从复制间容易发生复制延迟,尤其是在5.6以前的版本…...
保研考研机试攻略:python笔记(4)
🐨🐨🐨15各类查找 🐼🐼二分法 在我们写程序之前,我们要定义好边界,主要是考虑区间边界的闭开问题。 🐶1、左闭右闭 # 左闭右闭 def search(li, target): h = len(li) - 1l = 0#因为都是闭区间,h和l都可以取到并且相等while h >= l:mid = l + (h - l) // 2…...
如何保证缓存和数据库一致性
保证缓存和数据库一致性是分布式系统中的一个常见挑战。以下是几种常用的策略和方法,用于解决缓存与数据库之间的数据一致性问题: 1. 基础同步策略 基础同步策略包括以下几种常见的操作顺序: 先更新缓存再更新数据库:这种方法可能导致缓存中的数据成为脏数据,因为如果数…...
关于conda换镜像源,pip换源
目录 1. 查看当前下载源2. 添加镜像源2.1清华大学开源软件镜像站2.2上海交通大学开源镜像站2.3中国科学技术大学 3.删除镜像源4.删除所有镜像源,恢复默认5.什么是conda-forge6.pip换源 1. 查看当前下载源 conda config --show channels 如果发现多个 可以只保留1个…...
分布式服务框架 如何设计一个更合理的协议
1、概述 前面我们聊了如何设计一款分布式服务框架的问题,并且编码实现了一个简单的分布式服务框架 cheese, 目前 cheese 基本具备分布式服务框架的基本功能。后面我们又引入了缓存机制,以及使用Socket替代了最开始的 RestTemplate。并且还学习了网络相关…...
git客户端版本下载
1. 访问官方网站:您可以在git官方网站(https://git-scm.com)上找到git软件最新稳定版下载链接。 2.如果需要下载其它版本,可访https://github.com/git-for-windows/git/releases选择想要的版本下载。...
前端快速生成接口方法
大家好,我是苏麟,今天聊一下OpenApi。 官网 : umijs/openapi - npm 安装命令 npm i --save-dev umijs/openapi 在根目录(项目目录下)创建文件 openapi.config.js import { generateService } from umijs/openapi// 自…...
mysql 学习12 存储引擎,mysql体系结构
mysql 体系结构 存储引擎简介 存储引擎 就是 存储数据,建立索引,更新/查询 数据等技术的实现方式。 存储引擎 是基于表的,而不是基于库的,所以存储引擎也可以称为 表类型 mysql默认的使用InnoDB 做为存储引擎 查看一下我们之前…...
【Java八股文】02-Java集合面试篇
【Java八股文】02-Java集合面试篇 概念数组与集合区别常用集合Java中的线程安全的集合是什么?Collections和Collection的区别 Listjava中list的几种实现把ArrayList变成线程安全的有哪些方法?CopyOnWriteArrayList是如何保证线程安全的? Mapj…...
稀土抑烟剂——为汽车火灾安全增添防线
一、稀土抑烟剂的基本概念 稀土抑烟剂是一类基于稀土元素(如稀土氧化物和稀土金属化合物)开发的高效阻燃材料。它可以显著提高汽车内饰材料的阻燃性能,减少火灾发生时有毒气体和烟雾的产生。稀土抑烟剂不仅能提升火灾时的安全性,…...
Unity进阶教程AOI算法原理详解
最新课程《全栈双客户端(Unity/Cocos) TurnKey方案》更新了AOI专题,今天分享一下AOI算法的实现原理。 AOI的功能和作用 在MMORPG网路游戏当中,单服同时在线一般都会有几千人。当有个玩家执行一个操作,理想情况下要把玩家的操作广播同步给单…...
Python中的HTTP客户端库:httpx与request | python小知识
Python中的HTTP客户端库:httpx与request | python小知识 在Python中,发送HTTP请求和处理响应是网络编程的基础。requests和httpx是两个常用的HTTP库,它们都提供了简洁易用的API来发送HTTP请求。然而,httpx作为新一代的HTTP客户端…...
ASP.NET Core SignalR的分布式部署
假设聊天室程序被部署在两台服务器上,客户端1、2连接到了服务器A上的ChatRoomHub,客户端3、4连接到服务器B上的ChatRoomHub,那么客户端1发送群聊消息时,只有客户端1、2能够收到,客户端3、4收不到;在客户端3…...
【Elasticsearch】match查询
Elasticsearch 的match查询是全文搜索中最常用和最强大的查询类型之一。它允许用户在指定字段中搜索文本、数字、日期或布尔值,并提供了丰富的功能来控制搜索行为和结果。以下是match查询的详细解析,包括其工作原理、参数配置和使用场景。 1.match查询的…...
