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)启用 EPELSCLo 仓库

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/15044.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

编译spring 6.2.2

如何编译Spring 6.2.2 下载spring 6.2.2 首先&#xff0c;下载spring 6.2.2&#xff0c;地址&#xff1a;下载 解压到你的目录下。 下载gradle 下载gradle&#xff0c;这是spring项目的依赖管理工具&#xff0c;本文下载的是8.12.1 gradle下载 下载合适的JDK 本文下载的是…

深度求索(DeepSeek)的AI革命:NLP、CV与智能应用的技术跃迁

Deepseek官网&#xff1a;DeepSeek 引言&#xff1a;AI技术浪潮中的深度求索 近年来&#xff0c;人工智能技术以指数级速度重塑全球产业格局。在这场技术革命中&#xff0c;深度求索&#xff08;DeepSeek&#xff09;凭借其前沿的算法研究、高效的工程化能力以及对垂直场景的…

Android Studio超级详细讲解下载、安装配置教程(建议收藏)

博主介绍&#xff1a;✌专注于前后端、机器学习、人工智能应用领域开发的优质创作者、秉着互联网精神开源贡献精神&#xff0c;答疑解惑、坚持优质作品共享。本人是掘金/腾讯云/阿里云等平台优质作者、擅长前后端项目开发和毕业项目实战&#xff0c;深受全网粉丝喜爱与支持✌有…

计算机毕业设计Python+Vue.js游戏推荐系统 Steam游戏推荐系统 Django Flask 游 戏可视化 游戏数据分析 游戏大数据 爬虫

温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 作者简介&#xff1a;Java领…

版本更新|OpenCSG AutoHub v0.2.8

AutoHub v0.2.8现已发布&#xff01; AutoHub v0.2.8本次更新致力于提升用户体验、增强系统的兼容性和流畅性。通过优化单页应用的支持、提示语推荐功能以及新增页面跳转支持&#xff0c;用户在执行工作流时能够更加高效、便捷。同时&#xff0c;针对界面的多项优化&#xff0…

DeepSeek-R1模型的数学原理(说人话)

文章目录 1、什么是GRPO2、数学原理3、比喻4、流程总结 &#x1f343;作者介绍&#xff1a;双非本科大四网络工程专业在读&#xff0c;阿里云专家博主&#xff0c;前三年专注于Java领域学习&#xff0c;擅长web应用开发&#xff0c;目前已转行人工智能领域。 &#x1f985;个人…

智慧停车场解决方案(文末联系,领取整套资料,可做论文)

一、方案概述 本智慧停车场解决方案旨在通过硬件设备与软件系统的深度整合&#xff0c;实现停车场的智能化管理与服务&#xff0c;提升车主的停车体验&#xff0c;优化停车场运营效率。 二、硬件架构 硬件设备说明&#xff1a; 车牌识别摄像机&#xff1a;安装在停车场入口和…

对“云原生”的初印象

一、背景 最近因为在工作中以及一些技术博客中听的比较火的一个关键词 "云原生"&#xff0c;于是产生了好奇&#xff0c;云原生到底是什么东西&#xff1f;自己对云原生也是一个纯小白&#xff0c;于是带着这个问题去好好了解一下&#xff0c;什么是"云原生&qu…

物联网软件开发与应用方向应该怎样学习,学习哪些内容,就业方向是怎样?(文末领取整套学习视频,课件)物联网硬件开发与嵌入式系统

随着物联网技术的飞速发展&#xff0c;物联网软件开发与应用方向成为了众多开发者关注的焦点。那么&#xff0c;如何在这个领域中脱颖而出呢&#xff1f;本文将为你提供一份详细的学习指南&#xff0c;帮助你从零开始&#xff0c;逐步掌握物联网软件开发与应用的核心技能。 一…

数据结构-基础

1、概念&#xff1a; 程序 数据结构 算法 2、程序的好坏 可读性&#xff0c;稳定性&#xff0c;扩展性&#xff0c;时间复杂度&#xff0c;空间复杂度。 3、数据结构 是指存储、组织数据的方式&#xff0c;以便高效地进行访问和修改。通过选择适当的数据结构&#xff0c; 能…

蓝耘智算平台与DeepSeek R1模型:推动深度学习发展

公主请阅 前言何为DeepSeek R1DeepSeek R1 的特点DeepSeek R1 的应用领域DeepSeek R1 与其他模型的对比 何为蓝耘智算平台使用蓝耘智算平台深度使用DeepSeek R1代码解释&#xff1a;处理示例输入&#xff1a;输出结果&#xff1a; 前言 在深度学习领域&#xff0c;创新迭代日新…

神经网络(Neural Network)

引言 神经网络,作为人工智能和机器学习领域的核心组成部分,近年来在诸多领域取得了显著的进展。受生物神经系统的启发,神经网络通过模拟人脑神经元的工作机制,能够从大量数据中学习复杂的模式和关系。其强大的非线性建模能力使其在图像识别、自然语言处理、语音识别和预测…

基于python多线程多进程爬虫的maa作业站技能使用分析

基于python多线程多进程爬虫的maa作业站技能使用分析 技能使用分析 多线程&#xff08;8核&#xff09; import json import multiprocessing import requests from multiprocessing.dummy import Pooldef maa(st):url "https://prts.maa.plus/copilot/get/"m …

npm无法加载文件 因为此系统禁止运行脚本

安装nodejs后遇到问题&#xff1a; 在项目里【node -v】可以打印出来&#xff0c;【npm -v】打印不出来&#xff0c;显示npm无法加载文件 因为此系统禁止运行脚本。 但是在winr&#xff0c;cmd里【node -v】,【npm -v】都也可打印出来。 解决方法&#xff1a; cmd里可以打印出…

2.9寒假作业

web&#xff1a;[SWPUCTF 2022 新生赛]ez_ez_php(revenge) 打开环境&#xff0c;进行代码审计 下面有提示访问游戏flag.php&#xff0c;尝试看看 提示了正确的flag&#xff0c;还有要使用为协议&#xff0c;之前也了解过&#xff0c;关于执行包含文件例如include可使用为协议绕…

【Matlab优化算法-第13期】基于多目标优化算法的水库流量调度

一、前言 水库流量优化是水资源管理中的一个重要环节&#xff0c;通过合理调度水库流量&#xff0c;可以有效平衡防洪、发电和水资源利用等多方面的需求。本文将介绍一个水库流量优化模型&#xff0c;包括其约束条件、目标函数以及应用场景。 二、模型概述 水库流量优化模型…

Mybatis

入门 配置SQL提示 JDBC介绍 JDBC:(Java DataBase Connectivity)&#xff0c;就是使用Java语言操作关系型数据库的一套API 本质 sun公司官方定义的一套操作所有关系型数据库的规范&#xff0c;即接口 各个数据库厂商去实现这套接口&#xff0c;提供数据库驱动jar包 我们可以使…

Deepseek的MLA技术原理介绍

DeepSeek的MLA(Multi-head Latent Attention)技术是一种创新的注意力机制,旨在优化Transformer模型的计算效率和内存使用,同时保持模型性能。以下是MLA技术的详细原理和特点: 1. 核心思想 MLA技术通过低秩联合压缩技术,将多个注意力头的键(Key)和值(Value)映射到一…

使用 SDKMAN! 在 Mac(包括 ARM 架构的 M1/M2 芯片)上安装 Java 8

文章目录 1. 安装 SDKMAN!2. 查找可用的 Java 8 版本3. 安装 Java 84. 验证安装5. 切换 Java 版本&#xff08;可选&#xff09;6. 解决 ARM 架构兼容性问题总结 可以使用 SDKMAN! 在 Mac&#xff08;包括 ARM 架构的 M1/M2 芯片&#xff09;上安装 Java 8。SDKMAN! 是一个强大…

HAL库外设宝典:基于CubeMX的STM32开发手册(持续更新)

目录 前言 GPIO&#xff08;通用输入输出引脚&#xff09; 推挽输出模式 浮空输入和上拉输入模式 GPIO其他模式以及内部电路原理 输出驱动器 输入驱动器 中断 外部中断&#xff08;EXTI&#xff09; 深入中断&#xff08;内部机制及原理&#xff09; 外部中断/事件控…